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

THE FOLLOWING QUESTION IS FOR C PROGRAMMING LANGUAGE Printing the decimal equivalent of a binary number....
THE FOLLOWING QUESTION IS FOR C PROGRAMMING LANGUAGE Printing the decimal equivalent of a binary number. Write a program that accepts an integer (5 digits or fewer) containing only 0s and 1s (i.e., binary) and prints out its decimal equivalent using the remainder and division operator to select the "binary" digits one at a time. Make sure your input is tested for multiple options: incorrect characters, too many, too few, etc. I need help making this program. No loops, if...
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?
Problem: Convert the following binary number to decimal. 1. 110101.101 Problem: Convert the following decimal number...
Problem: Convert the following binary number to decimal. 1. 110101.101 Problem: Convert the following decimal number to fractional binary representation. 1. 103.5625
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 signed integer 0xACE9 to binary and decimal. Convert unsigned integer0xACE9 to binary and decimal.
Convert signed integer 0xACE9 to binary and decimal. Convert unsigned integer0xACE9 to binary and decimal.
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT