+ 2
#include <iostream> using namespace std; int main() {int a, b, sum= a+b; cout << "Enter 1st number \n"; cin >> a; cout << a <<
Why is my answer coming as 8??? For any nombers
3 Antworten
+ 3
Thank you so much for your response
+ 2
Post a link to your code inside of copy and pasting it also it’s cut off
+ 2
You always get 8 because you are trying to calculate the sum before assigning any meaningful values to "a" and "b". Move the calculation to a point after you have asked for user input.