0
Can someone tell me what's wrong with this code?
i just started using this app to learn programming. I had a difficulty to solve a problem. It should count down from n to 1 and each time n is a multiple of 5 it should print beep after the number. This is my code and I've checked and rechecked and even tested but I don't know what can be the problem as the system is saying something wrong. Thanks #include <iostream> using namespace std; int main() { int n; cin >> n; //your code goes here while (n>0){ cout << n << endl; if (n%5==0){ cout << "beep" << endl; } n--; } return 0; }
5 Answers
0
Read the assignment carefully, it should be written Beep with a capital letter.
I, too, was not attentive at first.
I had a problem - confused the semicolon. Then for several days I could not find the reason, gave up and sent it to the "Discussions", and for several days I waited for an answer, no one could understand - it seems that the code is working, but it does not work until one big-eyed has not considered it. âșïž
As a result, a whole week of wasted time.
After that, I made the font one size larger and there were no such problems anymore.
Happy coding! âșïž
+ 1
Thank you very much for your help!. I just corrected it and it functioned. đ
+ 1
It's true that when you are new in something it's not quite easy to detect some errors. I was wandering why my code was not working. Again and again I changed the code, but at the end I was having the same issue.
From now on I will be careful when reading the problem. Thank you one more. I spent several days on that code but I couldn't find the problem.đ
0
Please always tag the programming language.
https://code.sololearn.com/W3uiji9X28C1/?ref=app
0
And how do I tag the programming language. This is my first time using the discussion option.
Thanks