diff --git a/08-numbers-and-strings/01-numbers/exercises/03-precedence/main.go b/08-numbers-and-strings/01-numbers/exercises/03-precedence/main.go index faf8e9a..a046804 100644 --- a/08-numbers-and-strings/01-numbers/exercises/03-precedence/main.go +++ b/08-numbers-and-strings/01-numbers/exercises/03-precedence/main.go @@ -36,4 +36,7 @@ func main() { // This expression should print 15 fmt.Println(10 / 2 * 10 % 7) + + // This expression should print 40 + fmt.Println(100 / 5 / 2) } diff --git a/08-numbers-and-strings/01-numbers/exercises/03-precedence/solution/main.go b/08-numbers-and-strings/01-numbers/exercises/03-precedence/solution/main.go index 03a4345..109f94a 100644 --- a/08-numbers-and-strings/01-numbers/exercises/03-precedence/solution/main.go +++ b/08-numbers-and-strings/01-numbers/exercises/03-precedence/solution/main.go @@ -27,4 +27,7 @@ func main() { // 10 / 2 * 10 % 7 fmt.Println(10 / 2 * (10 % 7)) + + // 100 / 5 / 2 + fmt.Println(100 / (5 / 2)) } diff --git a/08-numbers-and-strings/01-numbers/questions/02-precedence.md b/08-numbers-and-strings/01-numbers/questions/02-precedence.md index 39778f1..0754db3 100644 --- a/08-numbers-and-strings/01-numbers/questions/02-precedence.md +++ b/08-numbers-and-strings/01-numbers/questions/02-precedence.md @@ -13,12 +13,13 @@ ```go 5 - (2 * 5) + 7 ``` -1. 2 -2. 22 *CORRECT* +1. 2 *CORRECT* +2. 22 3. -19 4. 36 5. -12 +> **1:** The expression can also be: 5 + (2 * 5) + 7 ## What's the result of the expression? ```go diff --git a/08-numbers-and-strings/01-numbers/questions/03-assignment-operations.md b/08-numbers-and-strings/01-numbers/questions/03-assignment-operations.md index 978997f..624ef53 100644 --- a/08-numbers-and-strings/01-numbers/questions/03-assignment-operations.md +++ b/08-numbers-and-strings/01-numbers/questions/03-assignment-operations.md @@ -89,8 +89,8 @@ var n int ## Which code below equals to `x = x % 2`? 1. `x = x / 2` -2. `x =% x` -3. `x %= x` *CORRECT* +2. `x =% 2` +3. `x %= 2` *CORRECT* > **1:** This is a division. You need to use the remainder operator. >