?? 十進制轉換成二進制.txt
字號:
using System;
class ggg
{
static void Main()
{
Console.WriteLine("請你輸入十進制,我為你轉換成二進制,謝謝使用。");
int a,b,d,f;
int c=0;
a=int.Parse(Console.ReadLine());
b=a;
do
{
b/=2;
c=++c;
}
while(b!=1);
d=c+1;
f=c;
int[] A=new int[d];
for(int i=c;i>0;i--)
{
A[i]=(int)a%2;
a/=2;
}
A[0]=1;
for(int j=0;j<=f;j++)
{
Console.Write(A[j]);
}
Console.WriteLine("\n"+"歡迎 使用,謝謝退出!");
System.Threading.Thread.Sleep(3000);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -