+ 2
c++ project 2(count down)
Hi guys... I need your help!! I've written the code to solve the project 2 in C++ (countdown) .when I click run ,it apears that I've solved case 1,case 2,case 4 and case 5 but case 3 no(**case 3,4 and 5 are hidden)i hope that you understand me. pleas help me, I am sure that mu code is correct 100%. that is my code: #include <iostream> using namespace std; int main(){ int n ; cin>>n; while(n>1){ if(n%5==0) cout<<"Beep"; n--; cout<<n<<endl; } } that is my code pleas help me I beg you.
12 ответов
+ 5
Input should be included in the output.
Also you need to get the all outputs in a new line.
Batool_Tarawneh I did a small change in your attempt
#include <iostream>
using namespace std;
int main(){
int n ;
cin>>n;
cout<<n<<endl;
while(n>1){
if(n%5==0)
cout<<"Beep"<<endl;
n--;
cout<<n<<endl;
}
}
That's it!
0
can you Post the task description also.?
edit: Batool_Tarawneh🦋
i mean task description "what is the task to be done by code"? all are not able to see it (not unlocked )
0
ok when I click run,that waht apears for me:
✅ Test case 1
✅Test case 2
❌Test case 3
(this test case is hidden)
✅Test case4
(this test case is hidden)
✅ Test case 5
(this test case is hidden)
what i have to do?
0
ok the task is
“You given to make a countdown app.
Given a number N as input,output from N to 1 on separare lines.
Also,when the current countdown is a multiple of 5, the app should output”Beep”.”
that is the task
help me I beg you.
0
in loop,
Use condition n>=1 instead of n>1.
First print n, after do n--;
Next add if case for printing beep..
I hope it helps.
0
Simba
can you write the hole code
because I didn’t understand you😅
and thank you very much💐
0
thank you all❤️
i did it❤️❤️
0
Simba thank you very much💐
0
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
while (n>0){
cout<<n<<"\n";
if (n%5==0)
cout<<"Beep"<<"\n";
n--;
}
return 0;
}
- 1
Helloo... I need some help. I've written the code for project 2 in C++ but irte just solver case 3 and case 5. I am starting here and i'm not sure of what I made
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
//tu código va aquí
while(n>=1){
if(n%5==0){
cout<<n<<endl;
cout <<"beep"<<endl;}
else{
cout<<n<<endl;
}
n-=1;
}
return 0;
}
Help me please