C Programming Binary to Decimal number and Decimal to Binary Conversion with C program

Binary to Decimal number and Decimal to Binary Conversion with C program

Decimal to Binary Conversion Using C language //WAP to convert a decimal number to a binary number #include<stdio.h> void main() { int n,i=1,r,ten=1,bin=0; printf(“Enter a decimal number:”); scanf(“%d”,&n); while(n>0) { r=n%2; bin=bin+r*ten; n/=2; ten=ten*10; } printf(“Your binary value is:%d”,bin); } Binary to Decimal Conversion Using C language //WAP to convert Read more…