answersLogoWhite

0


Best Answer

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

13y ago
This answer is:
User Avatar

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.

Related questions

Decimal to binary conversion in c language?

sscanf, atoi, strtol, ...


What does B C D stand for in math?

Binary coded decimal. Each decimal digit is represented by its binary equivalent.


How do you write a c program to convert binary to decimal by using while statement?

write a c++ program to convert binary number to decimal number by using while statement


Conversion of octal to decimal in c?

Possible.


What is the 4-binary number assoiated with the hexadecimal symbol C?

0xc = 1100 Hexadecimal digits use exactly 4 binary digits (bits). The 0x0 to 0xf of hexadecimal map to 0000 to 1111 of binary. Thinking of the hexadecimal digits as decimal numbers, ie 0x0 to 0x9 are 0 to 9 and 0xa to 0xf are 10 to 15, helps with the conversion to binary: 0xc is 12 decimal which is 8 + 4 &rarr; 1100 in [4 bit] binary.


How do you convert a binary number into a decimal in C?

sprintf (to, "%d", value)


Write a program in C to convert a binary number to its decimal equivalent?

#include#includemain(){int i,j=0,k;printf("enter u r binary number");scanf("%d",&i);while(i>0){k=i/10; // reminderi=i%10;// for dividentj=j+(k*pow(2,k));conversion function}printf("decimal number is :%d",j);}


What is the differentiate of turbo c from turbo c plus plus?

Turbo C compiles c source. turbo c++ compiles c++ source code.


How turbo c executes c as well as c?

turbo c cannot execute c++ as well..since c++ is the superset of c .the cprograms can be compiled in turbo c++.


Syntax of turbo c?

+ += - -= * *= / /= % %= = == != &lt;= &gt;= &amp; &amp;&amp; | ^ ~ &lt;&lt; &lt;&lt;= &gt;&gt; &gt;&gt;= , [] () are the basic operator in TURBO C


Write a c program to convert binary number to decimal number?

How is this a question? Sounds like you should do more of your homework offline.


What are the basic operator in turbo c?

+ += - -= * *= / /= % %= = == != &lt;= &gt;= &amp; &amp;&amp; | ^ ~ &lt;&lt; &lt;&lt;= &gt;&gt; &gt;&gt;= , [] () are the basic operator in TURBO C