15,392,679 members
See more:
So instead of printing the texts, the result I got was always only the first cout I inserted (2). I've only just started coding and I'm still grasping the basics. What do I do?

What I have tried:

```#include <iostream>
using namespace std;

int main ()
{
int x;
int y;
int sum;
int product;
int difference;
int quotient;
cout << "2";
cin >> x;
cout << "3";
cin >> y;
sum = x + y;
product = x*y;
quotient = x/y;
difference = x - y;
cout << "Sum is: " << sum<<endl;
cout << "Product is: " << product<<endl;
cout << "Quotient is: " << quotient<<endl;
cout << "Difference is: " << difference<<endl;
return 0;

}```
Posted
Updated 24-Oct-21 23:45pm
v3
Rick York 25-Oct-21 11:56am

If your program is waiting for input then it is usually best to output a message saying so. In your case, it should write, "Enter x value : " or something similar when it is waiting for x to be entered and something like that when it is waiting for y to be entered.

## Solution 1

It works fine when I try it.
1. It prints 2 and waits for an input number (x).
2. It prints 3 and waits for an input number (y).
3. It calculates the sum, product, quotient and difference of x and y.
4. It prints those values as shown below on my output:
```24
35
Sum is: 9
Product is: 20
Quotient is: 0
Difference is: -1```

What exactly do you think is wrong with the answers?
JJhis ae 25-Oct-21 6:05am

It only prints "2" on my pc for some reason but thank you for pointing out that the problem is only from my end
Richard MacCutchan 25-Oct-21 6:20am

That is correct, and at that point it is waiting for you to enter your choice of value for x. Similarly when it prints 3, you need to enter the value for y.

## Solution 2

If it prints "2" and does nothing at all after that, it's probably waiting for you to enter a number and press the ENTER key ...