Lesson 5 of 24

Loops: for, while, range-for

9 min 25 XP

for, while, do-while C போலவே. C++11-ல் range-based for: for (int x : list) ஒவ்வொரு உறுப்பையும் தரும்.

Example: edit me and press Run

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

Challenge

+25 XP

n-ஐப் படித்து முதல் n Fibonacci எண்களை space விட்டு print செய்யுங்கள் (0 1 1 2 ...). long long பயன்படுத்துங்கள். Input: 8 → Output: 0 1 1 2 3 5 8 13

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