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.