Lesson 7 of 23

for Loop

8 min 25 XP

for (start; condition; step) condition true असेपर्यंत चालतो. बेरीज, पाढे आणि factorials यांचा हाच पाया आहे.

Example: edit me and press Run

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

मोठ्या संख्यांसाठी long long वापरा आणि ती %lld ने print करा. int फक्त सुमारे 2 अब्जांपर्यंत जाते.

Challenge

+25 XP

n वाचा आणि 1 ते n मधील सम संख्यांची बेरीज print करा. Input: 10 → Output: 30

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