Lesson 7 of 23

for Loop

8 min 25 XP

for (start; condition; step) तब तक चलता है जब तक condition true है। योग, पहाड़े और factorial का यही आधार है।

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.