0

can someone explain why my code is false in this c++ question pls?

question: You need to make a countdown app. Given a number N as input, output numbers from N to 1 on separate lines. Also, when the current countdown number is a multiple of 5, the app should output "Beep" my code: #include <iostream> using namespace std; int main() { int n; cin >> n; while (n>0) { cout << n<< endl; if (n%5 == 0 ) { cout << "Beep \n"; } n--; } return 0; }

8th Feb 2021, 2:00 PM
Kiệt Triệu Chấn
Kiệt Triệu Chấn - avatar
2 ответов
+ 4
Don't print a space after the "Beep", it messes up the comparison between your output and the solution. That's all.
8th Feb 2021, 2:12 PM
Shadow
Shadow - avatar
+ 1
thx a lot!!!!
8th Feb 2021, 2:49 PM
Kiệt Triệu Chấn
Kiệt Triệu Chấn - avatar