हिंदी
तमिलनाडु बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान कक्षा ११

King Vikramaditya has two magic swords. With one, he can cut off 19 heads of a dragon, but after that, the dragon grows 13 heads. With the other sword, he can cut off 7 heads, but 22 new heads grow. - Computer Science

Advertisements
Advertisements

प्रश्न

King Vikramaditya has two magic swords. With one, he can cut off 19 heads of a dragon, but after that, the dragon grows 13 heads. With the other sword, he can cut off 7 heads, but 22 new heads grow. If all heads are cut off, the dragon dies. If the dragon has originally 1000 heads, can it ever die?

योग

उत्तर

No. of heads of dragon = 1000
sword 1: cuts 19 heads but 13 heads grow back.
sword 2: cuts 7 heads but 22 heads grow back.
Let n be the number of heads of the dragon at the initial state.

Case 1: King uses Sword 1
Sword 1 cuts off 19 heads but 13 heads grow back.
n : = n – 19 + 13 = n – 6 No. of heads are reduced by 6.

Case 2: King uses Sword 2
Sword 2 cuts 7 heads but 22 heads grow back.
n : = n – 7 + 22 = n + 15
No. of heads are increased by 15.

shaalaa.com
Invariants
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 8: Iteration and recursion - Evaluation - Section - C [पृष्ठ ११४]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 11 TN Board
अध्याय 8 Iteration and recursion
Evaluation - Section - C | Q 3. | पृष्ठ ११४
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×