Advertisement
nontawat1996

ฐาน 10 >> ฐาน 2

Dec 22nd, 2011
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int n,i=0,bit[32]={0},j;
  7.     scanf("%d",&n);
  8.     do
  9.     {
  10.         bit[i++]=n%2;
  11.         n=n/2;
  12.     }
  13.     while(n>0);
  14.  
  15.     for(j=i-1;j>=0;j--) printf("%d",bit[j]);
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement