डाउनलोड पी.डी.एफ. ई-बुक्स
C - Decimal To Binary Conversion

विवरण :

Click to Convert Decimal To Binary Number

सोर्स कोड :

#include<stdio.h>
#include

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;
}

आउटपुट :

Enter decimal value(0 to 9): 9 
Binary number= 1001