Ask Question
1 February, 09:35

Create an application named NumbersDemo whose main () method holds two integer variables. Assign values to the variables. In turn, pass each value to methods named displayTwiceTheNumber (), displayNumberPlusFive (), and displayNumberSquared ().

+1
Answers (1)
  1. 1 February, 10:36
    0
    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; }

    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).
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Create an application named NumbersDemo whose main () method holds two integer variables. Assign values to the variables. In turn, pass ...” in 📙 Engineering if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers