sprintf (to, "%d", value)
write a c++ program to convert binary number to decimal number by using while statement
How is this a question? Sounds like you should do more of your homework offline.
#include<stdio.h> main() { int d,a; printf("enter the number"); scanf("%d",&a); do { d=a%2; } while(a=0); printf("binary=%d",&d); }
It is C
#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]); }
#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);}
pongada punda vayanungala ..................
Binary coded decimal. Each decimal digit is represented by its binary equivalent.
The question asks to do nothing by converting a decimal into itself. Perhaps the question was mistyped. Please restate the question.
A = 1010 b = 1011 c = 1100
sscanf, atoi, strtol, ...
scanf