course content

Course Content

Numeral Systems 101

Welcome on Board!Welcome on Board!

Hi there!

Have you heard about numeral systems? If not, I suppose you used to work with one of them, the most popular one. It is called the decimal numeral system and describes all values, that you use in regular life, like 10,112,674 or 4. Indeed, there are three more commonly used systems like binary, octal, and hexadecimal, but we are going to get acquainted with them in the next chapters.

But why decimal? All numbers are ten-based we can simply decompose them to a thousand, hundred and dozens.

Rule

I'm going to explain it explicitly using the number 123. Imagine that each number has indices and the counting starting from the very right number: here we begin with the number 3 and assign it the index of 0. Subsequently, 2 has an index of 1, and 1 has an index of 2. Therefore, 3->0, 2->1, 1->2. To present a number in decimal representation we should multiply it by the ten raised to the power of index. For instance: 1x10^2=100, 2x10^1=20, 3x10^0=3; or we can say the decomposed number 123 consists of 100, 20, and 3.

Task

Gained knowledge should be practiced, it is a recipe for success! So now, it is time to present numbers in the decimal numeral system. Try to do it with the number 365🌍 You should follow the algorithm on the right and fill the gaps.

  1. Define the variable titled power and assign 0 to it.
  2. Define the loop that executes till the decimal_number is 0.
  3. Count the remainder of division decimal_number by 10.
  4. Multiply the last_digit by the 10 raised to the relevant power.
  5. Decrease decimal_number using integer division by 10.
  6. Print the result.

Once you've completed this task, click the button below the code to check your solution.

Everything was clear?

Section 1. Chapter 1
toggle bottom row