- 1
addition of two numbers after accepting from user
if i do int sum=a+b; in case of where i m adding two numbers after taking from user then it is showing incorrect answer can you please tell the reason behind it
3 Respostas
+ 1
int a, b;
std::cin >> a>> b;
int sum= a+b;
std::cout <<sum;
+ 1
It's generally wrong to sum before receiving values.
You're most likely to get 0.
0
I know that it will work in this manner but I am not able to understand why it's not working if we definitely sum before accepting valued