Code
using System;
using System.Collections;
class Ten
{
static void Main()
{
Console.WriteLine("Input the number!");
int ten=Int32.Parse(Console.ReadLine().Trim());
ArrayList al=new ArrayList();
while(ten>0)
{
if(ten%2==0)
{
al.Add(0);
ten=ten/2;
}else
{
al.Add(1);
ten=ten/2;
}
};
for(int i=al.Count-1;i<al.Count;i--)
{
if(i<0)break;
Console.Write(al[i]);
}
}
}
posted @
2008-12-17 12:35
Thinking.N
阅读(
456)
评论()
编辑
收藏
举报