Decimal To Binary Conversion

in Hindi - Decimal To Binary Conversion



Click to Convert Decimal To Binary Number

Source Code :

RUN#include <stdio.h>
#include<math.h>

int main()
{
int num, rem=0, num1=0, i=0;
printf("Enter decimal value(0 to 9): ");
scanf("%d",&num);

while(num > 0){
rem = num % 2;
num1 = num1 + rem * pow(10, i);
i++;
num = num / 2 ;
}
printf("Binary number= %d ", num1);

return 0;
}