static void tobin_core (int n)
{
if (n>1) tobin_core (n/2);
putchar ('0'+n%2);
}
void tobin (int n)
{
if (n<0) { putchar ('-'); n= -n; }
tobin_core (n);
}
write a c++ program to convert binary number to decimal number by using while statement
sprintf (to, "%d", value)
How is this a question? Sounds like you should do more of your homework offline.
#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]); }
Binary coded decimal. Each decimal digit is represented by its binary equivalent.
#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); }
A = 1010 b = 1011 c = 1100
sscanf, atoi, strtol, ...
It is C
scanf
C# EXAMPLEString text="My sample data";System.Text.ASCIIEncoding encode=new System.Text.ASCIIEncoding();//convert to binary and store in a byte[]byte[] binaryArray=encode.GetBytes(text);
cg code for binary tree