Add up to five · اجمع إلى خمسة
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. إهمال المؤثر تعني أن الحلقة لن تنتهي أبداً؛ وإهمال المجموع يعني أنه سينتهي فارغاً.
Use a while loop to add 1 + 2 + 3 + 4 + 5 into total. total should end as 15. · استخدم حلقة while لإضافة 1 + 2 + 3 + 4 + 5 إلى total. يجب أن ينتهي total كـ 15.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.