Lesson 8 of 23

while మరియు do-while

9 min 25 XP

Loop ఎన్నిసార్లో తెలియనప్పుడు while వాడండి. n % 10 చివరి అంకె, n / 10 దాన్ని తీసేస్తుంది. ఈ రెండు tricks reverse, palindrome-number, Armstrong-number ప్రశ్నలను పరిష్కరిస్తాయి.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

Condition ఎప్పటికీ false కాకపోతే loop శాశ్వతంగా నడుస్తుంది. ఇక్కడ కొన్ని సెకన్ల తర్వాత అది ఆటోమేటిక్‌గా ఆపబడుతుంది.

Challenge

+25 XP

ఒక సంఖ్యను చదవండి. తిరగేసినా అదే అయితే "Palindrome", లేకపోతే "Not palindrome" print చేయండి. Input: 1221 → Output: Palindrome

Output Loading C (first time takes a few seconds)
Press Run to see the result here.