answersLogoWhite

0

main()

{

int i,c=0,sum=0;

scanf("%d",&i);

while(i>=0)

{

i=i%2;

sum=sum+i*pow(10,c);

i=i/2;

c++

}

printf("%d",sum);

}

OR =)

#include<stdio.h>

#include<conio.h>

void showbits(int h)

{

if(h==1)

printf("%d",h);

else

{

showbits(h/2);

printf("%d",h%2);

}

}

void main()

{

int nu;

void showbits(int h);

clrscr();

printf("Num?");scanf("%d",&nu);

printf("\nBin eq of %d is ",nu);

showbits(nu);

getch();

}

User Avatar

Wiki User

14y ago

Still curious? Ask our experts.

Chat with our AI personalities

JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga

Add your answer:

Earn +20 pts
Q: Conversion of binary to decimal in turbo c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Other Math

C plus plus program that convert decimal to binary using the concept of stack?

#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; main() { int number,binary[10000],b=0; printf("Enter decimal number "); scanf("%d",&amp;number); printf("\nBinary: "); for(;number;number/=2,b++) binary[b]=number%2; for(b--;b&gt;-1;b--) printf("%d ",binary[b]); }


How do you convert hexadecimal form to binary form?

Each hexadecimal digit (or nybble) is the equivalent of 4 binary digits (or bits) with a decimal value of 0-15. Convert each nybble into (4) binary (digits) and string them together, remembering the conversion of decimal 0-15 to binary: Hex -&gt; Dec -&gt; Binary 0 -&gt; 00 -&gt; 0000 1 -&gt; 01 -&gt; 0001 2 -&gt; 02 -&gt; 0010 3 -&gt; 03 -&gt; 0011 4 -&gt; 04 -&gt; 0100 5 -&gt; 05 -&gt; 0101 6 -&gt; 06 -&gt; 0110 7 -&gt; 07 -&gt; 0111 8 -&gt; 08 -&gt; 1000 9 -&gt; 09 -&gt; 1001 A -&gt; 10 -&gt; 1010 B -&gt; 11 -&gt; 1011 C -&gt; 12 -&gt; 1100 D -&gt; 13 -&gt; 1101 E -&gt; 14 -&gt; 1110 F -&gt; 15 -&gt; 1111 So to convert 0x6AF to binary: 6 -&gt; 0110 A -&gt; 1010 F -&gt; 1111 =&gt; 0x6AF = 0110 1010 1111 = 011010101111 (without the spaces showing the hex nybbles)


Fibonacci sequence code in turbo-C?

turn off your pc.


Pseudocode for subtraction of two binary numbers?

start read a read b c=a-b print c end


How many decimal places would you move for a conversion from a cm to a mm?

k h da 1 . d c m kilo hecto deka meter, liter, gram, etc. (Base) . deci centi milli If you want to convert from centimeters to millimeters, move the decimal one decimal place to the right. King Henry Died By (Base) Drinking Chocolate Milk If you can remember the top or the acronym, you'll never have this problem again.