how to find binary of number?
Answers were Sorted based on User's Feedback
Answer / abhishek karnani
Here is a prgm to convert a decimal number to any base just
replace 2 by the base number of the desired number
#include<stdio.h>
#include<conio.h>
void main()
{
int d;
int i=0,n,j,b[100];
clrscr();
printf("\nEnter decimal number: ");
scanf("%d",&n);
while (n>0)
{
b[i]=n%2;
n=n/2;
i++;
}
printf("\nBinary is: ");
for (j=i-1;j>=0;j--)
{
printf("%d",b[j]);
}
getch();
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / 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 |
Are enumerations really portable?
can anyone please tell about the nested interrupts?
#include<stdio.h> void main() { int a [5]; for (i=0; i<=4; i++) printf(ā%dā ,a[i]); }
What’s a signal? Explain what do I use signals for?
What is the difference between struct and typedef struct in c?
What is the difference between declaring a variable and defining a variable?
How can I return multiple values from a function?
Hai friends im a i year student. i want to develop my knowledge in the field of TSR in c. How I'm Improve ?
writ a program to compare using strcmp VIVA and viva with its output.
what is the output of the following program? main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }
how many keywords are available in 'c' language a) 32 b) 34 c) 45 d) 48
What does c value mean?