Ada-C9 / BinaryAndDecimal

Homework exercises after CS Fun class on Binary and Memory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Binary and Decimal

Author a method based on the binary to decimal algorithm you devised in class.

Exercises

Write a method named binary_to_decimal that receives as input parameter an array of size 8. The array is randomly filled with 0’s and 1’s. Assuming that the array represents an eight bit binary number with the most significant bit at index 0 and the least significant bit at index 7, calculate the decimal value for this binary number using the algorithm you devised in class. Return the decimal value.

Note: Do not use Ruby functions. Author using the algorithm you devised in class.

About

Homework exercises after CS Fun class on Binary and Memory


Languages

Language:Ruby 100.0%