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 |
how can use subset in c program and give more example
What is the difference between CV and Resume ?
Do string constants represent numerical values?
explain what are actual arguments?
On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area
How do you initialize pointer variables?
Add 2 64 bit numbers on a 32 bit machine
3 Answers EMC, Hyderabad Central University, NetApp,
wap to print "hello world" without using the main function.
What are advantages and disadvantages of recursive calling ?
12 Answers College School Exams Tests, Evolving Systems, HP, Jyoti Ltd, Sage, Wipro,
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it?
How we can set and clear bit in a byte using macro function?
What do you mean by team??