Decimal number:
range : 0 to 9
Binary numnber :
range : 0 to 1
Decimal to binary conversion:
Example-
Decimal number is 8
Binary number is 1000
Decimal number is 23
Binary number is 10111
program-
#include< stdio.h>
int main() {
int n,num=0;
printf("Enter decimal number");
scanf("%d",&n);
while(n)
{
num=num*10+n%2;
n=n/2;
}
printf("It's binary is %d",num);
}
Enter decimal number
7
It's binary is 111
Enter decimal number
10
It's binary is 1010