Does anyone can help me?You need to make a countdown app. Given a number N as input, output numbers from N to 1 on separate lin | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Does anyone can help me?You need to make a countdown app. Given a number N as input, output numbers from N to 1 on separate lin

And I also made the code steel has bug #include <iostream> using namespace std; int main() { int n; cin >> n; int i; do{ if (n%5 == 0) cout<<n<<endl<<"beep"<<endl; else cout <<n<<endl; --n; }while (i<n); return 0; }

14th May 2022, 4:38 AM
Milad sadeghi
Milad sadeghi - avatar
2 Answers
0
You need to always cout n and only cout beep when n is divisble by 5.
14th May 2022, 6:08 AM
Raul Ramirez
Raul Ramirez - avatar
0
FYI you dont need i In the while loop you want to check if n > 0
14th May 2022, 6:10 AM
Raul Ramirez
Raul Ramirez - avatar