- 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
11 odpowiedzi
- 3
Sanjay
if (number % 5 == 0) print Beep
Very nice sound. Don't come in front of my Byke.
+ 3
Sanjay
Just start the loop in reverse order and print the value and also print Beep if number is multiple of 5.
+ 2
Have you tried to solve this at once?
If you had tried it can you please show your attempt?
+ 1
Help me to get beep sound ..😅during multiples of five
0
I Am Groot ! Which type of loop?
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.
0
Zatch bell #include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
while(n>0){
cout<<n<<endl;
n--;
}
return 0;
}
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
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;
}
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";
- 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;
}