Give you a number on base ten,you should output it on base two.(0 < n < 1000)
Input
For each case there is a postive number n on base ten, end of file.
Output
For each case output a number on base two.
#include<stdio.h>
#include<stdlib.h>
//#include<string.h>
//#include<math.h>
void main()
{
int n, arr[500], t = 0;
while (scanf("%d", &n) != EOF)
{
for (int i = 0; n!=0; i++)
{
arr[i] = n % 2;
n = n / 2;
t = i;
}
for (int i = t; i >= 0; i--)
printf("%d", arr[i]);
printf("\n");
}
system("pause");
}