write a console application has input a non-negative integer and show a string of binary bits representing n
انا مش فاهمة هو عايز اية؟size="6"]؟
write a console application has input a non-negative integer and show a string of binary bits representing n
انا مش فاهمة هو عايز اية؟size="6"]؟
السلام عليكم
يرجى رفع المشروع حتى نستطيع المساعدة
بالتوفيق
Be the change you want to see in the world
السلام عليكم ..
اقتباسwrite a console application has input a non-negative integer and show a string of binary bits representing nانا مش فاهمة هو عايز اية؟
public string DecimalToBinary(int num)
{
string result = string.Empty;
int rem = 0;
try
{
while (num > 0)
{
rem = num % 2;
num = num / 2;
result = rem.ToString() + result;
}
}
catch (Exception ex)
{
error = ex.Message;
}
return result;
}لا إله إلا الله ... محمد رسول الله
لو كانت مشاركتي مفيدة و تريد تشجيعي على المزيد من العطاء , فضلا قم بتقييم المشاركة
المعرًف القديم : houssam11350_11350
من مواضيعي : ArabGenCode : مولد كود و إجراءات مخزنة و واجهات لجداول سيكوال سيرفر
الأخ الكريم/الأخت الكريمة
السلام عليكم ورحمة الله وبركاته
مرحباً بكم في منتدى الفريق العربي للبرمجة
نود تنبيهك أن العنوان غير مناسب.
الرجاء اختيار عنوان مناسب أكثر في مواضيعك القادمة، وهذا بمثابة إشعار للأهمية.
وفي حال التكرار سيتعرض موضوعك للإغلاق والحذف!!!
قواعد المشاركة
شاكرين لكم حُسن تعاونكم
.:: Wish to become better and better ::.
اشكرك بشدة وانا حاولت اعملة وطلع مظبوط وهو دة الحل بتاعى
amespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{ int x = int.Parse(Console.ReadLine());
float y;
while (x > 0)
{
y = x % 2;
x = x / 2;
Console.WriteLine(y);
Console.ReadLine();
}
}
}
}