¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
C++
Using the code stub below, write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5, finalResult is 3. #include <iostream> using namespace std; int main() { int num1; int num2; int finalResult; cin >> num1; cin >> num2; /* Your solution goes here */ cout << "Final result: " << finalResult << endl; return 0; } https://sololearn.com/discuss/2834075/?ref=app
5 Respuestas
+ 1
I can just assign any variables to num1 and num2 and work with it right?
+ 1
Ok thank you
0
#include <iostream>
using namespace std;
int main() {
int num1;
int num2;
int finalResult;
cin >> num1;
cin >> num2;
/* Your solution goes here */
finalResult=(num1+num2)/3;
cout << "Final result: " << finalResult << endl;
return 0;
}
0
Bit if you check the question i poestec they say if num1 is 4 and num2 is 5
0
Martin Taylor so is it okay to add
num1 =4;
num2 = 5;