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.