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 |
What is c++ used for today?
how to print 212 as Twohundreds twelve plz provide me ans soon
What is FIFO?
Difference between Function to pointer and pointer to function
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
how can be easily placed in TCS.
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
What standard functions are available to manipulate strings?
WHAT IS MAXIMUM SIZE OF AN ARRAY IN C LANGUAGE?
8 Answers Carphone Warehouse, IBM, SAS,
create a C program that displays one z,two y's,three x's until twenty six A's. plzz answer i need it tomorrow.
Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod()
Why does not use getgh(); and <conio.h> in c language.