Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I only need the ada version, if you could make the code readable and clear that

ID: 3883507 • Letter: I

Question

I only need the ada version, if you could make the code readable and clear that would be great

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 O's and I'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, such that I = 0, 1, 2, , n-1. The decimal value, d = 4-1 × 2° + bn-2 × 21 + + bo × 2"-1 Sample Output 120013 EEFoL Sot a binary Ezzaz: Set binary O0AS EEEOEE Not binary Enter a binary Enter binary 10927 Other Requirements .As shown in the sample output, a validation must be performed to check if the String is binary .Add comments to your code to help make it more understandable .Add a comment at the top of the code that includes your name(s), date, and assignment number. Note: names(s) in case you worked on your assignments in groups of two's.

Explanation / Answer

Algorithm to convert Decimal to Binary number

C impementation of this program is

#include <stdio.h>

#include <conio.h>

long dToB(long a);

int main() {

    long decimal;

    printf("Enter a decimal number ");

    scanf("%ld", &decimal);

    printf("Binary number of %ld is %ld", decimal, dToB(decimal));

     

getch();

    return 0;

}

/* to convert a decimal to binary */

long dToB(long n) {

    int remainder;

long b = 0, i = 1;

  

    while(n != 0) {

        remainder = n%2;

        n = n/2;

        b= b + (remainder*i);

        i = i*10;

    }

    return b;

}