Click here to Skip to main content
15,893,588 members

Comments by Devansh Chowdhury (Top 3 by date)

Devansh Chowdhury 24-Aug-19 2:26am View    
?
Devansh Chowdhury 23-Aug-19 11:33am View    
i tried this but i want to reverse the number and also numbers divisible by 2 are giving a problem.
Devansh Chowdhury 23-Aug-19 11:33am View    
#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
int a,b,c,d,i;
b=0;
c=0;
scanf("%d",&a);
printf("%d\n",a);

i=a;
while(i>=1){
b=b*10;
b=b+i%2;
i=i/2;

}
printf("%d",b);



return 0;
}