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();
}
#include<stdio.h> #include<stdlib.h> main() { int number,binary[10000],b=0; printf("Enter decimal number "); scanf("%d",&number); printf("\nBinary: "); for(;number;number/=2,b++) binary[b]=number%2; for(b--;b>-1;b--) printf("%d ",binary[b]); }
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 -> Dec -> Binary 0 -> 00 -> 0000 1 -> 01 -> 0001 2 -> 02 -> 0010 3 -> 03 -> 0011 4 -> 04 -> 0100 5 -> 05 -> 0101 6 -> 06 -> 0110 7 -> 07 -> 0111 8 -> 08 -> 1000 9 -> 09 -> 1001 A -> 10 -> 1010 B -> 11 -> 1011 C -> 12 -> 1100 D -> 13 -> 1101 E -> 14 -> 1110 F -> 15 -> 1111 So to convert 0x6AF to binary: 6 -> 0110 A -> 1010 F -> 1111 => 0x6AF = 0110 1010 1111 = 011010101111 (without the spaces showing the hex nybbles)
turn off your pc.
start read a read b c=a-b print c end
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.
sscanf, atoi, strtol, ...
Binary coded decimal. Each decimal digit is represented by its binary equivalent.
write a c++ program to convert binary number to decimal number by using while statement
Possible.
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 → 1100 in [4 bit] binary.
sprintf (to, "%d", value)
#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);}
Turbo C compiles c source. turbo c++ compiles c++ source code.
turbo c cannot execute c++ as well..since c++ is the superset of c .the cprograms can be compiled in turbo c++.
+ += - -= * *= / /= % %= = == != <= >= & && | ^ ~ << <<= >> >>= , [] () are the basic operator in TURBO C
How is this a question? Sounds like you should do more of your homework offline.
+ += - -= * *= / /= % %= = == != <= >= & && | ^ ~ << <<= >> >>= , [] () are the basic operator in TURBO C