Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int x,y,z,n,b;
- printf("Enter number :");
- scanf("%d",&x);
- y=x;
- z=0;
- while (y){
- y=y/2;
- z++;
- }
- b=z-1;
- printf("Amount of numbers :%d\n",z);
- int a[z];
- while (x){
- // printf("%d",x%2);
- a[z-b]=x%2;
- b=b-1;
- x=x/2;
- }
- //printf("\n");
- printf("Your number :");
- while (z){
- printf("%d",a[z]);
- z=z-1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement