+ 1

What wrong with my code?

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". Code: #include <iostream> using namespace std; int main() { int n; cin >> n; while (n > 0) { if (n % 5 ==0){ cout << n << endl; cout << "beep" << endl; n = n - 1; } else; cout << n << endl; n = n - 1; } return 0; }

29th Nov 2020, 4:16 PM
Rasidin Hatta
Rasidin Hatta - avatar
3 Answers
0
Ok tq
29th Nov 2020, 4:19 PM
Rasidin Hatta
Rasidin Hatta - avatar