C Program To Convert Decimal To Binary
C Program To Convert Decimal To Binary
h>
int main()
{
long decimalnum, quotient;
int i, j = 0,remainder,base;
char output[100];
printf("Enter decimal number and base : \n ");
scanf("%ld%d", &decimalnum,&base);
quotient = decimalnum;
while (quotient != 0)
{
remainder = quotient % base;
if (remainder < 10)
output[j++] = 48 + remainder;
else
output[j++] = 55 + remainder;
quotient = quotient / base;
}