Plz help me to build this countdown app in c++ program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Plz help me to build this countdown app in c++ program

Countdown app in c++ program 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". Sample Input: 12 Sample Output: 12 11 10 Beep 9 8 7 6 5 Beep 4 3 2 1

13th Dec 2020, 1:59 PM
Sanjay
Sanjay - avatar
11 Answers
- 3
Sanjay if (number % 5 == 0) print Beep Very nice sound. Don't come in front of my Byke.
13th Dec 2020, 2:49 PM
A͢J
A͢J - avatar
+ 3
Sanjay Just start the loop in reverse order and print the value and also print Beep if number is multiple of 5.
13th Dec 2020, 2:05 PM
A͢J
A͢J - avatar
+ 2
Have you tried to solve this at once? If you had tried it can you please show your attempt?
13th Dec 2020, 2:42 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
Help me to get beep sound ..😅during multiples of five
13th Dec 2020, 2:46 PM
Sanjay
Sanjay - avatar
0
I Am Groot ! Which type of loop?
13th Dec 2020, 2:39 PM
Sanjay
Sanjay - avatar
0
Sanjay If I am talking reverse order then there can be only one loop it's for loop. You can use while loop and do while loop also. Depends on you.
13th Dec 2020, 2:41 PM
A͢J
A͢J - avatar
0
Zatch bell #include <iostream> using namespace std; int main() { int n; cin>>n; while(n>0){ cout<<n<<endl; n--; } return 0; }
13th Dec 2020, 2:45 PM
Sanjay
Sanjay - avatar
0
#include <iostream> using namespace std; int main() { int n;//input variable cout<<"Input number Upto 15"<<endl; cin>>n; cout<<"*****************************************"<<endl; cout<<"Countdown Begins"<<endl; cout<<"*****************************************"<<endl; //display if (n==1||n==2||n==3||n==4||n==5||n==6||n==7||n==8||n==9||n==10||n==11||n==12||n==13||n==14||n==15) { while (n>0) { cout<<n<<endl;//printing number if (n % 5==0) { cout<<"Beep"<<endl;//beep sound }//if n--;//reverse iteration }//while }//if else { cout<<"Invalid input"<<endl; } return 0; }//main
14th Dec 2020, 7:55 PM
Sehar Kanwal
Sehar Kanwal - avatar
0
#include <iostream> using namespace std; int main() { int n; cin >> n; for(int i=n;i>=1;i--) //your code goes here { if(i%5==0) { cout<<i<<endl; cout<<"Beep"<<endl; } else cout<<i<<endl; } return 0; }
23rd Feb 2021, 8:42 PM
Ashutosh Kumar
Ashutosh Kumar - avatar
0
int n; int i; cin >> n; //your code goes here for(int i=0; i<n; i++){ cout<<(n-i); if((n-i)%5==0){ cout<<"Beep";
21st Aug 2022, 8:14 AM
Hot of coffe
Hot of coffe - avatar
- 1
//This code will definitely work!! Happy Coding ❤️ #include <iostream> using namespace std; int main() { int n; cin >> n; for(int i= n;i>0;i-- ){ if(i%5==0){ cout << i << endl; cout << "Beep" << endl; } else{ cout << i << endl; } } return 0; }
10th May 2021, 6:54 AM
Nishant Chauhan
Nishant Chauhan - avatar