Converted everything to orgmode
converted everything to orgmode and added solution to the README files
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
# Task 1
|
||||
|
||||
This task is a text based task. You do not need to write any program/C++ file: the answer should be written in solutions.txt according to the indicated format. Lines that start with "#" are interpreted as comments. You can run the autograder to check correctness.
|
||||
|
||||
## Task
|
||||
|
||||
Which of the following expressions evaluate to `true`, which to `false`?
|
||||
|
||||
1. `3 >= 3`
|
||||
1. `true || false && false`
|
||||
1. `(true || false) && false`
|
||||
1. `3 > (1 < true)`
|
||||
1. `8 > 4 > 2 > 1`
|
||||
1. `2 < a < 4` (a is a variable of type int)
|
37
Informatik_I/Exercise_2/task_1/README.org
Normal file
37
Informatik_I/Exercise_2/task_1/README.org
Normal file
@@ -0,0 +1,37 @@
|
||||
#+TITLE: Task 1: Expression Evaluation
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
|
||||
This task is a text based task. You do not need to write any program/C++ file: the answer should be written in solutions.txt according to the indicated format. Lines that start with "#" are interpreted as comments. You can run the autograder to check correctness.
|
||||
|
||||
* Task
|
||||
|
||||
Which of the following expressions evaluate to =true=, which to =false=?
|
||||
|
||||
1. =3 >= 3=
|
||||
1. =true || false && false=
|
||||
1. =(true || false) && false=
|
||||
1. =3 > (1 < true)=
|
||||
1. =8 > 4 > 2 > 1=
|
||||
1. =2 < a < 4= (a is a variable of type int)
|
||||
|
||||
* Solutions
|
||||
|
||||
#+begin_src txt
|
||||
# Lines starting with # are comments. Spaces are ignored.
|
||||
|
||||
# Replace the question marks, indicating which of the following expression evaluate to true, which to false.
|
||||
|
||||
|
||||
1. 3 >= 3 == true
|
||||
|
||||
2. true || false && false == true
|
||||
|
||||
3. (true || false) && false == false
|
||||
|
||||
4. 3 > (1 < true) == true
|
||||
|
||||
5. 8 > 4 > 2 > 1 == false
|
||||
|
||||
6. 2 < a < 4 == true
|
||||
#+end_src
|
@@ -1,17 +0,0 @@
|
||||
# Lines starting with # are comments. Spaces are ignored.
|
||||
|
||||
# Replace the question marks, indicating which of the following expression evaluate to true, which to false.
|
||||
|
||||
|
||||
1. 3 >= 3 == true
|
||||
|
||||
2. true || false && false == true
|
||||
|
||||
3. (true || false) && false == false
|
||||
|
||||
4. 3 > (1 < true) == true
|
||||
|
||||
5. 8 > 4 > 2 > 1 == false
|
||||
|
||||
6. 2 < a < 4 == true
|
||||
|
@@ -1,25 +0,0 @@
|
||||
# Task
|
||||
|
||||
Translate the following natural language expressions to `C++` expressions. Assume that all the variables are non-negative integers or boolean (of value `true` or `false`).
|
||||
|
||||
_For this task you need to write the solutions in the `solutions.cpp` file, by filling the various functions that have been defined for each subtasks._
|
||||
|
||||
**Example:** $a$ is greater than $3$ and smaller than $5$. $\Longrightarrow$ Solution:
|
||||
|
||||
```cpp
|
||||
return a > 3 && a < 5;
|
||||
```
|
||||
|
||||
_Note:_ Do not confuse the bitwise logical operators (e.g., `&`) with their binary logical counterparts (`&&`). The semantics are slightly different — bitwise operators do not exhibit short circuit evaluation.
|
||||
|
||||
1. $a$ greater than $b$ and the difference between $a$ and $b$ is smaller than $15$.
|
||||
1. $a$ is an even natural number greater than $a$.
|
||||
1. $a$ is at most $5$ times greater than $b$ (but can also be smaller than $b$) and at least $5$ times greater than $c$.
|
||||
1. Either $a$ and $b$ are both false or $c$ is true, but not both.
|
||||
1. $a$ is false and $b$ is zero.
|
||||
|
||||
## Input
|
||||
|
||||
The program expects the task number as the first input followed by the parameters to the chosen task. For example, `3 5 1 1` selects task `3` with `a = 5`, `b = 1`, and `c = 1`.
|
||||
|
||||
Note that boolean parameters for tasks 4 and 5 are entered as true and false. For example `4 true false true` would run task `4` with `a = true`, `b = false`, and `c = true`.
|
86
Informatik_I/Exercise_2/task_2/README.org
Normal file
86
Informatik_I/Exercise_2/task_2/README.org
Normal file
@@ -0,0 +1,86 @@
|
||||
#+TITLE: Task 2: From Natural Language to C++
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
Translate the following natural language expressions to =C++= expressions. Assume that all the variables are non-negative integers or boolean (of value =true= or =false=).
|
||||
|
||||
/For this task you need to write the solutions in the =solutions.cpp= file, by filling the various functions that have been defined for each subtasks./
|
||||
|
||||
*Example:* \(a\) is greater than \(3\) and smaller than \(5\). \(\Longrightarrow\) *Solution:*
|
||||
|
||||
#+begin_src cpp
|
||||
return a > 3 && a < 5;
|
||||
#+end_src
|
||||
|
||||
/Note:/ Do not confuse the bitwise logical operators (e.g., =&=) with their binary logical counterparts (=&&=). The semantics are slightly different — bitwise operators do not exhibit short circuit evaluation.
|
||||
|
||||
1. \(a\) greater than \(b\) and the difference between \(a\) and \(b\) is smaller than \(15\).
|
||||
1. \(a\) is an even natural number greater than \(a\).
|
||||
1. \(a\) is at most \(5\) times greater than \(b\) (but can also be smaller than \(b\)) and at least \(5\) times greater than \(c\).
|
||||
1. Either \(a\) and \(b\) are both false or \(c\) is true, but not both.
|
||||
1. \(a\) is false and \(b\) is zero.
|
||||
|
||||
** Input
|
||||
|
||||
The program expects the task number as the first input followed by the parameters to the chosen task. For example, =3 5 1 1= selects task =3= with =a = 5=, =b = 1=, and =c = 1=.
|
||||
|
||||
Note that boolean parameters for tasks 4 and 5 are entered as true and false. For example =4 true false true= would run task =4= with =a = true=, =b = false=, and =c = true=.
|
||||
|
||||
* Solutions
|
||||
|
||||
#+begin_src cpp
|
||||
#include "solutions.h"
|
||||
|
||||
// Fill out each function with the appropriate expression
|
||||
|
||||
bool task1(int a, int b) {
|
||||
// a greater than b and the difference between a and b is smaller than 15.
|
||||
if (a > b && (a - b) < 15) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task2(int a) {
|
||||
// a is an even natural number greater than 3.
|
||||
if (a > 3 && a % 2 == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task3(int a, int b, int c) {
|
||||
// a is at most 5 times greater than b (but can also be smaller than b)
|
||||
// and at least 5 times greater than c.
|
||||
if (a <= 5 * b && a >= 5 * c) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task4(bool a, bool b, bool c) {
|
||||
// Either a and b are both false or c is true, but not both.
|
||||
if ((a == false && b == false) != (c == true)) {
|
||||
return true; // Replace with your solution
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task5(bool a, int b) {
|
||||
// a is false and b is zero.
|
||||
if (a == false && b == false) {
|
||||
return true;
|
||||
} else {
|
||||
return false; // Replace with your solution
|
||||
}
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,49 +0,0 @@
|
||||
#include "solutions.h"
|
||||
|
||||
// Fill out each function with the appropriate expression
|
||||
|
||||
bool task1(int a, int b) {
|
||||
// a greater than b and the difference between a and b is smaller than 15.
|
||||
if (a > b && (a - b) < 15) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task2(int a) {
|
||||
// a is an even natural number greater than 3.
|
||||
if (a > 3 && a % 2 == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task3(int a, int b, int c) {
|
||||
// a is at most 5 times greater than b (but can also be smaller than b)
|
||||
// and at least 5 times greater than c.
|
||||
if (a <= 5 * b && a >= 5 * c) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task4(bool a, bool b, bool c) {
|
||||
// Either a and b are both false or c is true, but not both.
|
||||
if ((a == false && b == false) != (c == true)) {
|
||||
return true; // Replace with your solution
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task5(bool a, int b) {
|
||||
// a is false and b is zero.
|
||||
if (a == false && b == false) {
|
||||
return true;
|
||||
} else {
|
||||
return false; // Replace with your solution
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
# Task
|
||||
|
||||
_Fibonacci numbers_ are the integers in the following sequence: $0, 1, 1, 2, 3, 5, 8, 13, 21, ...$. Each number is the sum of the two previous numbers.
|
||||
|
||||
_Fibonacci primes_ are Fibonacci numbers that are also prime numbers. Write a program that asks the user for an integer $m$ and then computes and prints all Fibonacci primes between $0$ and $m$ (including). Print each number on a new line.
|
||||
|
||||
Finally, on a new line print the total number of Fibonacci primes found.
|
||||
|
||||
## Example
|
||||
|
||||
If your program is asked to print the Fibonacci primes between $0$ and $14$ the output should look something like this:
|
||||
|
||||
```
|
||||
2
|
||||
3
|
||||
5
|
||||
13
|
||||
Found 4 Fibonacci primes
|
||||
```
|
||||
|
||||
**Important:** using anything other than `int` (e.g., `unsigned int`, floating point numbers, `long`, or double `long`) is forbidden.
|
@@ -1,3 +1,30 @@
|
||||
#+TITLE: Task 3a: Fibonacci primes
|
||||
|
||||
* Task
|
||||
|
||||
/Fibonacci numbers/ are the integers in the following sequence: \(0, 1, 1, 2, 3, 5, 8, 13, 21, ...\). Each number is the sum of the two previous numbers.
|
||||
|
||||
/Fibonacci primes/ are Fibonacci numbers that are also prime numbers. Write a program that asks the user for an integer \(m\) and then computes and prints all Fibonacci primes between \(0\) and \(m\) (including). Print each number on a new line.
|
||||
|
||||
Finally, on a new line print the total number of Fibonacci primes found.
|
||||
|
||||
** Example
|
||||
|
||||
If your program is asked to print the Fibonacci primes between $0$ and $14$ the output should look something like this:
|
||||
|
||||
#+begin_src shell
|
||||
2
|
||||
3
|
||||
5
|
||||
13
|
||||
Found 4 Fibonacci primes
|
||||
#+end_src
|
||||
|
||||
*Important:* using anything other than =int= (e.g., =unsigned int=, floating point numbers, =long=, or double =long=) is forbidden.
|
||||
|
||||
* Solutions
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
@@ -45,3 +72,8 @@ int main() {
|
||||
// End message
|
||||
std::cout << count << "\n";
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-—---
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,58 +0,0 @@
|
||||
# Mistakes
|
||||
|
||||
- The variable `j` goes into overflow which is not allowed!
|
||||
|
||||
# Fibonacci overflow check
|
||||
|
||||
## Background
|
||||
|
||||
_Fibonacci numbers_ are the integers in the following sequence: $0, 1, 1, 2, 3, 5, 8, 13, 21, ...$, where each number is the sum of the two previous numbers.
|
||||
|
||||
## Task
|
||||
|
||||
Fibonacci numbers grow fast, and can thus easily exceed the value range of 32-bit `int`. Think of a general way how you can check if the result of an addition would exceed the range of a 32-bit `int` (i.e. overflow) **without actually performing the addition causing the overflow.**
|
||||
|
||||
Remember that we consider **signed integers.** Because only half of the numbers are positive, this leaves us with 31 bits to store the actual positive number value.
|
||||
|
||||
Write a program that asks the user for an integer $n$ and then prints the first $n$ Fibonacci numbers, each number on a new line. Use an `int` (we assume 32 bits, including the sign) to represent the current Fibonacci number. **Most importantly:** exit the print loop as soon as you detect that an overflow _would occur._
|
||||
|
||||
Finally, again on a new line, output the count $c$ of Fibonacci numbers previously printed, and the initial input $n$ from the user, in the format: `c of n`.
|
||||
|
||||
### Example:
|
||||
|
||||
Let's (wrongly!) assume that $5$ cannot be represented using a 32 bit int. This means that $3$ is the largest 32-bit Fibonacci number. If your program is asked to print the first $4$ Fibonacci numbers the output should look as follows:
|
||||
|
||||
```
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
Printed 4 of 4 Fibonacci numbers
|
||||
```
|
||||
|
||||
If you instead ask it to print the first 100 Fibonacci numbers the output should look as follows:
|
||||
|
||||
```
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
Printed 5 of 100 Fibonacci numbers
|
||||
```
|
||||
|
||||
**Important:** using anything other than `int` (e.g., `unsigned int`, floating point numbers, `long`, or double `long`) is forbidden.
|
||||
|
||||
**Restrictions:**
|
||||
|
||||
- The program **must not** rely on the knowledge of its final result. In particular, it is not allowed to hard-code
|
||||
- the largest 32-bits Fibonacci number, or
|
||||
- the number of digits that it has, or
|
||||
- the total number of Fibonacci numbers representable with a 32-bit int
|
||||
- Most importantly: do not perform additions that cause an overflow on 32 bit
|
||||
|
||||
**Note:** It is straightfoward to compute the largest (signed) integer representable with 32 bits. You are also explicitly allowed to hard-code this value in your program.
|
||||
|
||||
---
|
||||
|
||||
**Warning:** The autograder does not catch if an addition causes an overflow or if you do anything that's disallowed in the "Restrictions" section above, but you will receive 0 points when your TA corrects and catches this.
|
94
Informatik_I/Exercise_2/task_3b/README.org
Normal file
94
Informatik_I/Exercise_2/task_3b/README.org
Normal file
@@ -0,0 +1,94 @@
|
||||
#+TITLE: Task 3b: Fibonacci overflow check
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Background
|
||||
|
||||
/Fibonacci numbers/ are the integers in the following sequence: \(0, 1, 1, 2, 3, 5, 8, 13, 21, ...\), where each number is the sum of the two previous numbers.
|
||||
|
||||
* Task
|
||||
|
||||
Fibonacci numbers grow fast, and can thus easily exceed the value range of 32-bit =int=. Think of a general way how you can check if the result of an addition would exceed the range of a 32-bit =int= (i.e. overflow) *without actually performing the addition causing the overflow.*
|
||||
|
||||
Remember that we consider *signed integers.* Because only half of the numbers are positive, this leaves us with 31 bits to store the actual positive number value.
|
||||
|
||||
Write a program that asks the user for an integer \(n\) and then prints the first $n$ Fibonacci numbers, each number on a new line. Use an =int= (we assume 32 bits, including the sign) to represent the current Fibonacci number. *Most importantly:* exit the print loop as soon as you detect that an overflow /would occur./
|
||||
|
||||
Finally, again on a new line, output the count \(c\) of Fibonacci numbers previously printed, and the initial input \(n\) from the user, in the format: =c of n=.
|
||||
|
||||
** Example:
|
||||
|
||||
Let's (wrongly!) assume that \(5\) cannot be represented using a 32 bit =int=. This means that \(3\) is the largest 32-bit Fibonacci number. If your program is asked to print the first \(4\) Fibonacci numbers the output should look as follows:
|
||||
|
||||
#+begin_src shell
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
Printed 4 of 4 Fibonacci numbers
|
||||
#+end_src
|
||||
|
||||
If you instead ask it to print the first 100 Fibonacci numbers the output should look as follows:
|
||||
|
||||
#+begin_src shell
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
Printed 5 of 100 Fibonacci numbers
|
||||
#+end_src
|
||||
|
||||
*Important:* using anything other than =int= (e.g., =unsigned int=, floating point numbers, =long=, or double =long=) is forbidden.
|
||||
|
||||
*Restrictions:*
|
||||
|
||||
- The program **must not** rely on the knowledge of its final result. In particular, it is not allowed to hard-code
|
||||
- the largest 32-bits Fibonacci number, or
|
||||
- the number of digits that it has, or
|
||||
- the total number of Fibonacci numbers representable with a 32-bit int
|
||||
- Most importantly: do not perform additions that cause an overflow on 32 bit
|
||||
|
||||
*Note:* It is straightfoward to compute the largest (signed) integer representable with 32 bits. You are also explicitly allowed to hard-code this value in your program.
|
||||
|
||||
-----
|
||||
|
||||
*Warning:* The autograder does not catch if an addition causes an overflow or if you do anything that's disallowed in the "Restrictions" section above, but you will receive 0 points when your TA corrects and catches this.
|
||||
|
||||
* Mistakes
|
||||
|
||||
- The variable =j= goes into overflow which is not allowed!
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int a = 0; // First Fibonacci number
|
||||
int b = 1; // Second Fibonacci number
|
||||
int j = 0; // New Fibonacci number
|
||||
int c = 0; // Number of Fibonacci numbers
|
||||
int max = 2147483647;
|
||||
int n; // Input integer
|
||||
|
||||
std::cin >> n;
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
|
||||
if (max - a < b) { // Check if the new Fibonacci number goes into overflow
|
||||
break;
|
||||
} else { // otherwise, calculate next Fibonacci number
|
||||
std::cout << j << "\n";
|
||||
a = b;
|
||||
b = j;
|
||||
j = a + b;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
std::cout << c << " of " << n; // End Message
|
||||
}
|
||||
#+end_src
|
||||
|
||||
—----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,26 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int a = 0; // First Fibonacci number
|
||||
int b = 1; // Second Fibonacci number
|
||||
int j = 0; // New Fibonacci number
|
||||
int c = 0; // Number of Fibonacci numbers
|
||||
int max = 2147483647;
|
||||
int n; // Input integer
|
||||
|
||||
std::cin >> n;
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
|
||||
if (max - a < b) { // Check if the new Fibonacci number goes into overflow
|
||||
break;
|
||||
} else { // otherwise, calculate next Fibonacci number
|
||||
std::cout << j << "\n";
|
||||
a = b;
|
||||
b = j;
|
||||
j = a + b;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
std::cout << c << " of " << n; // End Message
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
## Task
|
||||
|
||||
Write a program that inputs a non-negative integer `n` (but store it as `int`) and outputs the binary digits of `n` in the _correct_ order (i.e., starting with the most significant bit). Do not output the leading zeros or the sign.
|
||||
|
||||
**Hint:** In order to find the largest integer $k$ such that $2^k \leq x$, you can utilize that $k$ is the smallest integer such that $2^k > \frac{x}{2}$. This observation is particularly useful to avoid an overflow for the expression $2^k$ when searching for the most significant bit to represent $x$.
|
||||
|
||||
**Restrictions:**
|
||||
|
||||
- Libraries: only the iostream standard library header is allowed; using arrays, string or cmath is not permitted.
|
||||
- Operators: you may not use bitshift operators to manipulate the numbers.
|
||||
|
||||
---
|
||||
|
||||
**Warning:** The autograder does not catch if you do anything that's disallowed in the "Restrictions" section above, but you will receive 0 points when your TA corrects and catches this.
|
54
Informatik_I/Exercise_2/task_4/README.org
Normal file
54
Informatik_I/Exercise_2/task_4/README.org
Normal file
@@ -0,0 +1,54 @@
|
||||
#+TITLE: Task 4: From decimal to binary representation
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
Write a program that inputs a non-negative integer =n= (but store it as =int=) and outputs the binary digits of =n= in the /correct/ order (i.e., starting with the most significant bit). Do not output the leading zeros or the sign.
|
||||
|
||||
*Hint:* In order to find the largest integer \(k\) such that \(2^k \leq x\), you can utilize that \(k\) is the smallest integer such that \(2^k > \frac{x}{2}\). This observation is particularly useful to avoid an overflow for the expression \(2^k\) when searching for the most significant bit to represent \(x\).
|
||||
|
||||
*Restrictions:*
|
||||
|
||||
- Libraries: only the iostream standard library header is allowed; using arrays, string or cmath is not permitted.
|
||||
- Operators: you may not use bitshift operators to manipulate the numbers.
|
||||
|
||||
-----
|
||||
|
||||
*Warning:* The autograder does not catch if you do anything that's disallowed in the "Restrictions" section above, but you will receive 0 points when your TA corrects and catches this.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int i = 0; // Input integer
|
||||
int d = 0; // Input Number
|
||||
int a = 0; // Part of binary number
|
||||
int b = 0; // Number to divide
|
||||
int count = 0;
|
||||
|
||||
std::cin >> i;
|
||||
d = i;
|
||||
b = i;
|
||||
|
||||
if (i < 0) {
|
||||
return 0;
|
||||
} else if (i == 0) {
|
||||
std::cout << 0;
|
||||
} else {
|
||||
while (d != 0) {
|
||||
d = d / 2;
|
||||
++count;
|
||||
}
|
||||
for (; count > 0; --count) {
|
||||
for (int j = count; j > 1; --j) {
|
||||
b = b / 2;
|
||||
}
|
||||
a = b % 2;
|
||||
std::cout << a;
|
||||
b = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
#+end_src
|
@@ -1,32 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int i = 0; // Input integer
|
||||
int d = 0; // Input Number
|
||||
int a = 0; // Part of binary number
|
||||
int b = 0; // Number to divide
|
||||
int count = 0;
|
||||
|
||||
std::cin >> i;
|
||||
d = i;
|
||||
b = i;
|
||||
|
||||
if (i < 0) {
|
||||
return 0;
|
||||
} else if (i == 0) {
|
||||
std::cout << 0;
|
||||
} else {
|
||||
while (d != 0) {
|
||||
d = d / 2;
|
||||
++count;
|
||||
}
|
||||
for (; count > 0; --count) {
|
||||
for (int j = count; j > 1; --j) {
|
||||
b = b / 2;
|
||||
}
|
||||
a = b % 2;
|
||||
std::cout << a;
|
||||
b = i;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user