C++ project 21 extra return | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

C++ project 21 extra return

I get an extra return with my code. How do I eliminate this? #include <iostream> using namespace std; int main() { int n; cin >> n; while (n>=1) { cout << n << endl; if (n%5==0){ cout << "Beep \n";} n--; } ; return 0; }

16th Jan 2022, 6:49 PM
Brian
2 Answers
+ 1
Hi What do you mean by "extra return"? Btw, next time you post a piece of code, don't copy the code, and the file instead. That way, we can watch the file execute and edit it! Another thing, you could use the for loop instead of the while loop in this task Have a nice day!!:)
16th Jan 2022, 7:23 PM
Alexandre
Alexandre - avatar
0
Extra return means? But I think, you have an extra space in "Beep \n". Just use " Beep\n"
16th Jan 2022, 7:22 PM
Jayakrishna 🇮🇳