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-এর ভেতরে তাতে যোগ করতে থাকুন। মোট এভাবেই হিসাব করা হয়।

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.