Lesson 10 of 34

for loop: மீண்டும் மீண்டும் செய்தல்

8 min 25 XP

for loop-ல் மூன்று பகுதிகள்: தொடக்கம் (int i = 1), condition (i <= 5), மாற்றம் (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 உள்ளே மதிப்புகளைச் சேர்க்கலாம். இதுவே கூட்டுத்தொகை (sum) கணக்கிடும் வழி.

Example: edit me and press Run

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

Loop உள்ளே உருவாக்கப்பட்ட i, loop-க்கு வெளியே கிடைக்காது.

Challenge

+25 XP

ஒரு எண் n-ஐப் படித்து அதன் பெருக்கல் வாய்ப்பாட்டை (multiplication table) 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.