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

Denary to binary · ⁨عشري ثنائي⁩

English

Denary to binary

Go the other way: from a denary number to its binary digits.

Divide by 2 again and again. The remainder n % 2 is the next bit, and n // 2 is what is left to convert. The remainders come out right to left, so put each new bit at the front of the string. 0 needs its own answer, because the loop would never run.

العربية

عشري إلى ثنائي

اذهب بالاتجاه المعاكس: من رقم عشري إلى أجزائه الثنائية.

اقسم على 2 مراراً وتكراراً. الباقي n % 2 هو البت التالي، وn // 2 هو المتبقي للتحويل. تظهر البواقي من اليمين إلى اليسار، لذا ضع كل بت جديد في بداية السلسلة. 0 يحتاج إجابته الخاصة، لأن الحلقة لن تعمل أبداً.

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

IGCSE, A-Level & AP