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.
4/14/2021 12:53:45 AM
Francesca Castle2 Answers
New AnswerHave 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.
#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; }
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message