Ask Question
4 March, 14:48

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. 4 March, 16:39
    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?
Find 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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers