Question

In: Computer Science

Code in C-language programming description about convert binary number to decimal number.

Code in C-language programming description about convert binary number to decimal number.

Solutions

Expert Solution

#include

 

void main(){

  auto int dec,bin;//declear veriable

  int dec_to_bin(int bin);

  printf("Enter a decimal number : ");//print information

  scanf("%d",&dec);//input decimal number

  bin=dec_to_bin(dec);

  printf("The decimal number is = %d\n",dec);

  printf("The bnunary number is = %d",bin);

}

int dec_to_bin(int d){

  auto int b,r,y;

  extern

  b=0;y=1;

  while(d>0){

    r=d%2;d=d/2;

    b=b+r*y;

    y=y*10;

  }

  return(b);//return value of b

}


Related Solutions

Code in C++ programming language description about read and write data to memory example.
Code in C++ programming language description about read and write data to memory example.
Convert the decimal number, 315.56 into binary form?
Convert the decimal number, 315.56 into binary form?
Code in C++ programming language description about lesson Calculator (multiple, sum, dived, sub) example.
Code in C++ programming language description about lesson Calculator (multiple, sum, dived,  sub) example.
Convert the following binary number to dotted decimal format. 11000000100110010000100101011001
Convert the following binary number to dotted decimal format. 11000000100110010000100101011001
Write a c++ program to convert any decimal number to either binary base  or Hex base...
Write a c++ program to convert any decimal number to either binary base  or Hex base number system. Test your program with the followings: Convert 15 from decimal to binary.  Convert 255 from decimal to binary. Convert BAC4 from hexadecimal to binary Convert DEED from hexadecimal to binary.  Convert 311 from decimal to hexadecimal. Convert your age to hexadecimal.
Class object in C++ programming language description about lesson inheritance example.
Class object in C++ programming language description about lesson inheritance example.
Class object in C++ programming language description about lesson inheritance example.
Class object in C++ programming language description about lesson inheritance example.
C Programming Language (Code With C Programming Language) Problem Title : Which Pawn? Jojo is playing...
C Programming Language (Code With C Programming Language) Problem Title : Which Pawn? Jojo is playing chess himself to practice his abilities. The chess that Jojo played was N × N. When Jojo was practicing, Jojo suddenly saw a position on his chessboard that was so interesting that Jojo tried to put the pieces of Rook, Bishop and Knight in that position. Every time he put a piece, Jojo counts how many other pieces on the chessboard can be captured...
Class object in C++ programming language description about lesson Overloading function example.
Class object in C++ programming language description about lesson Overloading function example.
Class object in C++ programming language description about lesson copy constructor example.
Class object in C++ programming language description about lesson copy constructor example.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT