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.