#+TITLE: Task 2: Representation of Integers
#+AUTHOR: JirR02

* Task

/This task is a text-based task but mostly automatically checked. You are required to write your answers into =submission.txt= by replacing the question marks with the correct solution. Please, do not change the line formating./

/You can check whether your solution is correct by clicking on the test button./

Numbers can be provided in various formats in C++. Literals prefixed with =0b= indicate binary encoding. Assume unsigned arithmetics with sufficient numbers of bits, i.e. no overflows. Convert the following binary numbers into decimal numbers (1-4) and decimal numbers to binary (5-8):

#+begin_src txt
# Lines starting with # are comments. Spaces is ignored.
# Lines starting with a whitespace before # will not be a comment.

# Convert to decimal:
0b1           = ?
0b10          = ?
0b000001      = ?
0b101010      = ?

# Convert to binary:
7             = ?
11            = ?
28            = ?
1024          = ?
#+end_src

* Solutions

#+begin_src txt
# Lines starting with # are comments. Spaces are ignored.
# Lines starting with a whitespace before # will not be a comment.

# Convert to decimal:
0b1           = 1
0b10          = 2
0b000001      = 1
0b101010      = 42

# Convert to binary:
7             = 0b111
11            = 0b1011
28            = 0b11100
1024          = 0b10000000000
#+end_src

—----

Made by JirR02 in Switzerland 🇨🇭
