0
Solve countdown app questions please
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 make a beep.
2 Respostas
+ 4
Have you tried to code it yourself yet? Give it shot and if you have issues share your code and describe the problem(s) you're having.
You need to get the input first.
Then loop from that number down to 1.
In the loop check if the number is a multiple of 5 using the modulo operator.
If it is, output beep, otherwise, output the number.
+ 2
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n>=1) {
cout << n << endl; {
if (n%5==0)
cout << "Beep" << endl;
} n--;
}
return 0;
}