Write a C++ program to prompt a user to enter two values for integers x and y, then display what the user inputs in a single line as shown:
You entered: 5 for x and 10 for y!
Answers
Answered by
0
First, read the input from the user and store them in 2 variables (for example, x and y).
Second, you check if x - y is negative. If it’s negative, you put this in the expression -(x-y)/(x+y). If it's positive, just put in the expression (x-y)/(x+y).
Answered by
1
Answer:
Explanation:
In this program, user is asked to enter two integers. These two integers are stored in variables firstNumber and secondNumber respectively. Then, the variables firstNumber and secondNumber are added using + operator and stored in sumOfTwoNumbers variable. Finally, sumOfTwoNumbers is displayed on the screen.
Similar questions
Social Sciences,
3 hours ago
World Languages,
3 hours ago
Math,
3 hours ago
Computer Science,
5 hours ago
Math,
5 hours ago
Hindi,
8 months ago
Chemistry,
8 months ago
Math,
8 months ago