Binary coded decimal (BCD) is easier to convert between displayed or printed form than is pure binary.
#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<stdio.h> main() { int d,a; printf("enter the number"); scanf("%d",&a); do { d=a%2; } while(a=0); printf("binary=%d",&d); }
this isn't the fact that the binary number 11 will have decimal equivalent 11... instead it have decimal number 1011 for decimal equivalant 11.here is the alogorithms for converting the decimal number to binary equivalent...!!!#include#includevoid main(){ int i,n,j,b[100];clrscr();printf("Enter a Number:");scanf("%d",&n);i=0;while(n>0){b[i]=n%2;n=n/2;i++;}printf("\n\nBinary Equivalent:");j=i-1;for(i=j;j>=0;j--)printf("%d",b[j]);getch();}using this algorithms... the binary equivalent of any number is taken out...!!! enjoy... have any query... email at :- "devilllcreature@yahoo.com" thank you....!!!
# include <stdio.h> void Rec_Dec_To_Bin (int num); void main () { int num; int base; printf ("Enter the decimal number to convert it binary.\n"); scanf ("%d", &num); printf ("The number in decimal is : %d\n", num); printf ("\n"); printf ("The %d in binary is : ", num); Rec_Dec_To_Bin (num); printf ("\n\n"); } void Rec_Dec_To_Bin (int num) { if (((num / 2) != 0) && (num > 1)) { Rec_Dec_To_Bin ((num / 2)); } printf ("%d", (num % 2)); }
analyzing and breaking coded messages.
The main advantage is that you can get an answer quickly.
You are not specific enough. The main advantage of what? It does not make any sense.
#include<stdio.h> #include<conio.h> void main() { int num_dec,num_bin[10],i=0; printf("\nEnter the number in Decimal : "); scanf("%d",&num_dec); while(num_dec>0) { num_bin[i]=num_dec%2; num_dec/=2; i++; } i--; printf("\n Binary equivalent is : "); while(i>=0) { printf("%d",num_bin[i]); i--; } getch(); }
include <iostream> using namespace std; int main() { int n; // number to convert to binary while (cin >> n) { if (n > 0) { cout << n << " (decimal) = "; while (n > 0) { cout << n%2; n = n/2; } cout << " (binary) in reverse order" << endl; } else { cout << "Please enter a number greater than zero." << endl; } } return 0; }//end main
No. The binary number only uses the digits 0 and 1. In decimal, once you reach the maximum digit (9), to add one more you change it back to zero and add one to the digit on the left. In binary it is the same principle; with the main difference that only the digits 0 and 1 are used. Thus, the first numbers in binary (with decimal in parentheses) are: 0 (0) 1 (1) 10 (2) 11 (3) 100 (4) 101 (5) 110 (6) 111 (7) 1000 (8) etc.
main advantage of storing documents in a hierarchy
The main advantage of ECL over TTL is speed.