#include <stdio.h>
#include <math.h>
void main()
{
long int d_n, rem, b_n = 0, base=1;
printf("Enter a decimal number : ");
scanf("%ld",&d_n);
printf("\n\n\nYour entered decimal number is : %ld",d_n);
while(d_n!=0)
{
rem=d_n%2;
b_n+=rem*base;
base*=10;
d_n/=2;
}
printf("\nYahoo Your entered decimal number is converted into binary");
printf("\nAnd the number is : %ld",b_n);
return 0;
}
#include <math.h>
void main()
{
long int d_n, rem, b_n = 0, base=1;
printf("Enter a decimal number : ");
scanf("%ld",&d_n);
printf("\n\n\nYour entered decimal number is : %ld",d_n);
while(d_n!=0)
{
rem=d_n%2;
b_n+=rem*base;
base*=10;
d_n/=2;
}
printf("\nYahoo Your entered decimal number is converted into binary");
printf("\nAnd the number is : %ld",b_n);
return 0;
}
No comments:
Post a Comment