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.