标签:style blog http io color ar sp for div
十进制转二进制水题
http://acm.hdu.edu.cn/showproblem.php?pid=2051
注意的是倒序输出是for(i=k-1;i>=0;i--)
#include<stdio.h> int main() { int i,n,a[10],k; while(scanf("%d",&n)!=EOF){ k=0; while(n!=0){ a[k]=n%2; n=n/2; k++; } for(i=k-1;i>=0;i--){ printf("%d",a[i]); } printf("\n"); } return 0; }
标签:style blog http io color ar sp for div
原文地址:http://www.cnblogs.com/Yvettey-me/p/4083278.html