how to find binary of number?

Answer Posted / kamalb008

#include<stdio.h>
main()
{
int a,i,b,n;/*i have taken arbitary base u can enter the
base what ever u need*/
printf("enter the number and the base u want to conv resp");
scanf("%d%d",&a,&n);
i=1;
while(i<=20)
{
if(a<n)
break;
b=a%n;
a=a/n;
printf("\nLSB%d of the converted number is %d",i,b);
i++;
}
printf("\nMSB of the conv is %d",a);
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data structure in c and its types?

597


How are structure passing and returning implemented?

593


Where static variables are stored in memory in c?

524


What is the scope of static variable in c?

537


What is table lookup in c?

632






What is an endless loop?

804


What is "Duff's Device"?

703


What is echo in c programming?

559


Can you think of a logic behind the game minesweeper.

2011


What are header files in c programming?

658


if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.

4506


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3342


What is wrong with this declaration?

613


what do you mean by inline function in C?

619


What does volatile do?

568