0
Why there is no output? Is there suppose to have Number=1,Number=2,Number=3...until 5?
#include <iostream> using namespace std; int main() { int num = 1; if (num=3){ num+=3; } else { num= 1; } while (num < 6) { cout << "Number: " << num << endl; num++; } return 0; }
2 Answers
+ 6
you are setting it equal to (=)
instead of testing for equality (==)
... If num==3
0
Thank you! Oh that "else" is useless over here.