Lesson 10 of 34

for Loop

8 min 25 XP

for loop కు మూడు భాగాలు: ప్రారంభం (int i = 1), condition (i <= 5), step (i++). Condition true గా ఉన్నంత వరకు loop నడుస్తూనే ఉంటుంది.

Example: edit me and press Run

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

Loop కు ముందు ఒక variable సృష్టించి, loop లోపల దానికి కలుపుతూ వెళ్ళండి. Totals ఇలాగే లెక్కిస్తాం.

Example: edit me and press Run

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

Loop లో declare చేసిన variable, i వంటిది, loop బయట ఉండదు.

Challenge

+25 XP

ఒక సంఖ్య n ను చదివి 1 నుండి 10 వరకు దాని ఎక్కం print చేయండి. Input: 7 Output: 7 x 1 = 7 7 x 2 = 14 ... 7 x 10 = 70

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