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.

14th Apr 2021, 12:53 AM
Francesca Castle
Francesca Castle - avatar
2 Answers
+ 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.
14th Apr 2021, 2:14 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
#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; }
1st Apr 2022, 11:20 AM
Avorgah Senyo
Avorgah Senyo - avatar