Input
第一行:输入数字T 表示接下来将有T组输入数据
接下来T行,每行输入一个数字N (0<=N<=10^9)
Output
输出该数字的二进制
注意:0 输出 0
Sample Input
5
0
1
2
3
4
Sample Output
0
1
10
11
第一行:输入数字T 表示接下来将有T组输入数据
接下来T行,每行输入一个数字N (0<=N<=10^9)
Output
输出该数字的二进制
注意:0 输出 0
Sample Input
5
0
1
2
3
4
Sample Output
0
1
10
11
100
#include<stdio.h>
#include<stdlib.h>
void printbin(int num)
{
if (num==0)
return;
printbin(num/2);
printf("%d",num%2);
}
int main(){
int T,n;
scanf("%d",&T);
while(T--){
scanf("%d",&n);
if(n==0){printf("0\n");continue;}
printbin(n);
putchar('\n');
}
return 0;
}