Answer:
The solution code is written in C++.
- int main() {
-
- int a = 5;
- int b = 4;
-
- displayTwiceTheNumber(a);
- displayTwiceTheNumber(b);
-
- displayNumberPlusFive(a);
- displayNumberPlusFive(b);
-
- displayNumberSquared(a);
- displayNumberSquared(b);
-
- return 0;
- }
-
- void displayTwiceTheNumber(int num){
- cout << num * 2;
- }
-
- void displayNumberPlusFive(int num){
- cout << num + 5;
- }
-
- void displayNumberSquared(int num){
- cout << num * num;
- }
Step-by-step explanation:
Firstly, create two integer variables, a and b and two sample values are assigned to the two variables, respectively (Line 3-4). Next, we pass the value of each variable a and b to the methods named displayTwiceTheNumber(), displayNumberPlusFive(), and displayNumberSquared() (Line 6- 13).