Ask Question
2 March, 20:22

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 ().

+2
Answers (1)
  1. 2 March, 20:32
    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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers