Question: !! Calculating Binary In this assignment, you are asked to solve a problem using 3 different programming languages: Python (33.33%), Ada (33.33%), and VB (33.33%).
!!
Calculating Binary In this assignment, you are asked to solve a problem using 3 different programming languages: Python (33.33%), Ada (33.33%), and VB (33.33%). You are required to find a compiler for each of the mentioned languages and test them on your own machines. The Problem Given a binary String as input, composed of 0's and 1's, give the decimal value for the input. Algorithm Given a binary string, b, of size, n, indexed 0, 1, 2, ... , n - 1. Denote character's integer value of b as b_i such that i = 0, 1, 2, ... , n - 1. The decimal value, d = b_n - 1 times 2^0 + b_n - 2 times 2^1 + ... + b_0 times 2^n - 1 Sample Output Enter a binary: 120013 Error: Not a binary Enter a binary: 1010w10 Error: Not a binary: Enter a binary: 100A11
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
