0

I need help, i dont know where the error is

#include <iostream> using namespace std; int main() { int a, b; int suma; cout << "ingresa el valor de a \n"; cin >> a; cout << "ingrese el valor de b \n"; cin >> b; suma = a + b; cout <<"la suma es: " <<suma <<endl; return 0; }

1st Oct 2021, 11:39 PM
Pablo
Pablo - avatar
4 Answers
+ 7
0-kool , if your code will be used in a code coach exercise (sololearn tutorial), you should be aware that no inputs or outputs can be done except the ones that are demanded. [EDITED: i suppose you are trying to do exercice 6.2 in c++ tutorial] â–Șthis means that you should comment out the lines that gives a user prompt for inputting the 2 values. â–Șalso rework the final output of the result by removing the string ... int a, b; int suma; //cout << "ingresa el valor de a \n"; // <<< cin >> a; //cout << "ingrese el valor de b \n"; // <<< cin >> b; suma = a + b; cout <<suma <<endl; // <<< ... happy coding and good success!
2nd Oct 2021, 11:24 AM
Lothar
Lothar - avatar
+ 3
Seems to work just fine.
1st Oct 2021, 11:47 PM
Simon Sauter
Simon Sauter - avatar
+ 2
There is no problem as I see it. What input did you give for <a> and <b>? Here's a guide to providing input in Code Playground https://code.sololearn.com/WhiNb9BkJUVC/?ref=app P.S. Please include a relevant language C++ in the tags above, where it says "suma" ☝ https://code.sololearn.com/W3uiji9X28C1/?ref=app
1st Oct 2021, 11:42 PM
Ipang
+ 2
Thank you very much i can descover the problem
2nd Oct 2021, 4:14 PM
Pablo
Pablo - avatar