Skip to content · ⁨الانتقال إلى المحتوى⁩

Add up to five · ⁨اجمع إلى خمسة⁩

English

Add up to five

Use a while loop to add 1 + 2 + 3 + 4 + 5 into total. total should end as 15.

Two things change every time round: the running total, and the counter n. Miss the counter and the loop never ends; miss the total and it ends with nothing in it.

العربية

اجمع حتى خمسة

استخدم حلقة while لإضافة 1 + 2 + 3 + 4 + 5 إلى total. يجب أن ينتهي total كـ 15.

شيئان يتغيران في كل دورة: المجموع الجاري total، والمؤثر n. إهمال المؤثر تعني أن الحلقة لن تنتهي أبداً؛ وإهمال المجموع يعني أنه سينتهي فارغاً.

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP