Question

Convert the following numbers from binary to decimal: 101.101001    0.000101 1.0 Convert the following numbers...


Convert the following numbers from binary to decimal:

101.101001   

0.000101

1.0

Convert the following numbers from decimal to binary:

12.28125

0.0234375

0.7

***If you could show some of the work so I can understand how to do this better, that would be greatly appreciated.

0 0
Add a comment Improve this question Transcribed image text
Answer #1


import java.util.Scanner;
public class example {


public static void main(String[] args) {
  
Scanner sc = new Scanner( System.in );
System.out.println("enter binary: ");

float bnum=sc.nextFloat();
float bnry=bnum;
  
int dec = 0;
int pow = 0;

while(true){

if(bnry == 0){

break;

} else {

float tmpr = bnry%10;
dec += tmpr*Math.pow(2, pow);
bnry = bnry/10;
pow++;

}
}
System.out.println("binary is:="+bnry+" decimal is:="+dec); ;
}

}
ouput:
enter binary:
01
binary is:=0.0 decimal is:=1
enter binary:
1.0
binary is:=0.0 decimal is:=1




import java.util.Scanner;
public class example {


public static void main(String[] args) {
  
   int i = 12;

String num = Integer.toBinaryString(i);
  
System.out.println("decimal to binary:");
System.out.println("val is:" + i + " is :" +num);
  
}

}
output:
decimal to binary:
val is:12 is :1100

Add a comment
Know the answer?
Add Answer to:
Convert the following numbers from binary to decimal: 101.101001    0.000101 1.0 Convert the following numbers...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Convert the following numbers to binary.  Do not be concerned with normalization or the hidden bit for...

    Convert the following numbers to binary.  Do not be concerned with normalization or the hidden bit for the purpose of this assignment. (PLEASE SHOW STEPS SO I CAN EASILY UNDERSTAND. THANK YOU.) 58.4298095703125 calculated to eleven binary digits to the right of the decimal. 33.4021 calculated to eleven binary digits to the right of the decimal. 39.875 calculated to eleven binary digits to the right of the decimal.

  • Need some help with my CS homework. 47. Convert the following numbers from decimal to binary:...

    Need some help with my CS homework. 47. Convert the following numbers from decimal to binary: (a) 12.28125 (b) 0.0234375 (c) 0.7 49 (b) With excess 15 representation, what is the range of numbers as written in binary and in decimal for a five-bit cell? 50. Assuming a three-bit exponent field and a four-bit significand, write the bit pattern for the following decimal values: (c) 0.43 (d) 0.1015625

  • 1. Convert the binary number 10101102 to octal, decimal, and hexadecimal numbers. 2. Convert the decimal...

    1. Convert the binary number 10101102 to octal, decimal, and hexadecimal numbers. 2. Convert the decimal number 236.7510 to binary,octal, and hexadecimal numbers. 3. Add the following two binary numbers: 100111102 and 011110112. Remember to show any carries that are generated along the way. 4. Repeat the previous question, but this time subtract the second binary number from the first. Remember to show any borrows that are required along the way. 5. Determine the encoding of the decimal number 28610...

  • 2. Convert the following numbers from binary to decimal. a. 1100012 = b. 11100112 = 3....

    2. Convert the following numbers from binary to decimal. a. 1100012 = b. 11100112 = 3. Convert the following numbers from decimal to binary. EET 1131 Unit 1 Practice sheet -2 a. 6610 = b. 9210 = 4. Convert the following numbers from binary to hexadecimal. a. 1101010012 = b. 11110112= 5. Convert the following numbers from hexadecimal to binary. a. 6C116= b. 83F16 = 6. Convert the following numbers from hexadecimal to decimal. a. 1A2F16 = b. 83F16 =...

  • Convert the decimal numbers A and B to 5-bit binary numbers. Using two’s complement representation, show...

    Convert the decimal numbers A and B to 5-bit binary numbers. Using two’s complement representation, show (i) how to subtract the two 5-bit binary numbers (A−B); (ii) how to translate the binary result back to decimal

  • (10pts) Convert the following decimal numbers to binary, octal and hexadecimal numbers a. 27 b. 650...

    (10pts) Convert the following decimal numbers to binary, octal and hexadecimal numbers a. 27 b. 650 vert the following binary numbers to decimal, octal and numbers a. 1101 b. 10101.11 (10pts) Convert the following octal numbers to decimal, binary and hexadecimal numbers (10pts) Convert the following hexadecimal numbers to decimal, binary and octal numbers a. 4F b. 3D65E

  • assignment 1 1. Convert the numbers 47 and 23 from Decimal to Binary. 2. Convert 11011...

    assignment 1 1. Convert the numbers 47 and 23 from Decimal to Binary. 2. Convert 11011 and 11101 from Binary to Decimal Show all steps. Use Word to write your answers, then save and upload the file.

  • 2. Convert the following two's complement binary numbers to decimal numbers. These numbers are integers.

    2. Convert the following two's complement binary numbers to decimal numbers. These numbers are integers. a. 110101 b. 01101010 c. 10110101 3. Convert the following decimal numbers to 6-bit two's complement binary numbers and add them. Write the results in 6-bit two's complement binary number format and decimal number format. Indicate whether or not the sum overflows a 6-bit result. a. 14 + 12 b. 30 + 2 C. -7 + 20 d. -18-17 4. What is the signed/magnitude and two's complement range of...

  • Convert the following decimal numbers to 10-bit unsigned binary numbers. Show your work. (a) 8910 (b)...

    Convert the following decimal numbers to 10-bit unsigned binary numbers. Show your work. (a) 8910 (b) 44510 (c) 10910 (d) 75310    Please Help

  • Convert the following decimal numbers into 8-bit binary: 214 _____________ Convert the following 8-bit binary numbers...

    Convert the following decimal numbers into 8-bit binary: 214 _____________ Convert the following 8-bit binary numbers into decimal: 10110111 ____________________ Convert the following decimal numbers into equivalent hexadecimal numbers: 253 ____________________ Convert the following hexadecimal numbers into equivalent decimal numbers: AE0 ____________________ Convert the following IP addresses into binary. Do not forget to put the period, or dot, between each group of eight binary digits: 206.79.125.83 _____________________________________________________________________ For the following exercises, come up with the subnet address, broadcast address, the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT