Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Viet chuong trinh doi 1 so nguyen duong 10 sang he 2
- // Khai bao thu vien chuong trinh neu co
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int x;
- scanf("%d",&x);
- int a[100],t,i,k;
- k=0;
- while(x>0)
- {
- k++;
- t=x%2;
- a[k]=t;
- x=x/2;
- }
- for(i=k;i>0;i--)
- {
- printf("%d ",a[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement