The question is somewhat ambiguous. If you have a value stored in a c variable, you can output it as a hexadecimal value by using a %x specification (printf("%x",z); prints z as a hex value.
There is no specification (in most versions of c to input a binary number).
If you mean convert a string which looks like a binary number to a string which looks like a hexadecimal number, then here is a code fragment
char b[21]; // b holds binary string - 1 extra byte for null
char h[6]; // h holds hex string - 1 extra byte for null
char *p;
int s;
p=b;
s=0;
while (*p)
{
s = (s << 1) + (*p-'0');
p++;
}
sprintf(h,"%x",s);
write a c++ program to convert binary number to decimal number by using while statement
pongada punda vayanungala ..................
The question asks to do nothing by converting a decimal into itself. Perhaps the question was mistyped. Please restate the question.
The answer will depend on what you want to convert into a decimal number.
This is not a question.
How is this a question? Sounds like you should do more of your homework offline.
3.27 is already a decimal number.
It is C
If the number is already in decimal form, you do not need to do anything to "convert" it to decimal!
To convert a fraction to a decimal divide the numerator (top number) by the denominator (bottom number). To convert a decimal (or fraction) to a percentage multiply it by 100 %.
Convert the mixed number to a decimal and proceed.
Convert the mixed number to a decimal.