0
why isn't this adding 20 to the number given by the user.
I wrote it once and managed to get it right after playing with it for awhile then closed it without saving it and now can't figure out what I'm doing wrong. it just keeps repeating the number input by the user. #include <iostream> using namespace std; int main(){ int a; cout << "Enter a number and I'll add 20 to it till it reaches 290! \n"; cin >> a; for(int b=a;b<290;b+20){ cout << b <<endl; } }
2 odpowiedzi
+ 4
It's b+=20 not b+20
0
aah yep that's it!! thank u. feel stupid now. lol