#include <iostream> using namespace std; int main() { int num = 1; int number; int total = 0; while (num <= 5) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

#include <iostream> using namespace std; int main() { int num = 1; int number; int total = 0; while (num <= 5)

Tell ne how this program works

25th Oct 2020, 1:43 PM
Sada
2 Answers
+ 1
Your program is not finished.
25th Oct 2020, 1:48 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
You should increment num in the while loop so that it loops for limited time and execute whatever you want inside loop num += 1 for example and total += num then you can use cout to display the total variable value .
25th Oct 2020, 1:56 PM
HBhZ_C
HBhZ_C - avatar