Computer Science, asked by sm9092476, 6 months ago

QUESTION 4
Write a method convert () to compute and print the decimal equivalent of the following binary
numbers. 10, 110, 1101, 1010, 11110. [15]

Answers

Answered by jannat0800
0

Explanation:

128 + 0 + 0 + 16 + 0 + 4 + 2 + 0 = 150. This is the decimal equivalent of the binary number 10010110.

Answered by Oreki
1

static void convert( ) {

String[ ] numbers = {"10", "110", "1101", "1010", "11110"};

for (String binary : numbers)

System.out.printf("%s - %d%n", binary, Integer.parseInt(binary, 2));

}

Similar questions