/
description.en.yml
19 lines (12 loc) · 1.11 KB
/
description.en.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
name: Commutative operation
theory: |
"An operation will not change if the operands are moved” is one of the basic laws of arithmetic, also called **the commutative law**. A binary operation is considered commutative if you get the same result even if you swap the operands. In this case, addition is a commutative operation: `3 + 2 = 2 + 3'.
But subtraction is not a commutative operation: `2 - 3 ≠ 3 - 2'. In programming, this law applies just like it does in arithmetic. Moreover, most of the operations we encounter in real life are not commutative. Here's the takeaway: always pay attention to the order of things you work with.
instructions: |
Write a program that calculates and displays sequentially (one value per line) the values of the following mathematical expressions: "3 to the power of 5" and "-8 divided by -4".
tips: []
definitions:
- name: Commutativity
description: |
the property of an operation where changing the order of operands does not affect the result. For example, addition is a commutative operation: changing the order of the numbers we are adding doesn't change the result.