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

Count up to five · ⁨عد إلى خمسة⁩

English

Count up to five

Use a while loop to print 1 to 5, one per line. Start n at 1.

Counting up needs n = n + 1 instead of n - 1, and a question that stops at the right place. n <= 5 lets 5 through; n < 5 would stop one early.

العربية

عد حتى خمسة

استخدم حلقة while لطباعة 1 إلى 5، واحد لكل سطر. ابدأ n عند 1.

العد التصاعدي يحتاج n = n + 1 بدلاً من n - 1، وسؤال يتوقف في المكان الصحيح. n <= 5 يسمح لـ 5 بالمرور؛ بينما n < 5 سيتوقف مبكراً.

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

IGCSE, A-Level & AP