plz help me (c++)😓 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

plz help me (c++)😓

cannot count my code, my output converges with the output in the example (counts two hidden tests, and does not count the other three) You need to create a countdown app. You are given a number N, print each number from N to 1 on a separate line. Also, when the current countdown number is a multiple of 5, the application should display "Beep". Example Input Data: 12 Sample Output Data: 12 11 10 Beep 9 8 7 6 5 Beep 4 3 2 1 https://code.sololearn.com/cSvyK7ycAiPJ/?ref=app

12th Jul 2021, 6:20 PM
Nick Solonar 🇷🇺
Nick Solonar 🇷🇺 - avatar
3 Answers
+ 3
Nick Solonar 🇷🇺 b should be in Caps. It's "Beep" And also change for loop: for(; timer != 0; --timer) { cout << timer << endl; if(timer % 5 == 0) { cout << "Beep" << endl; } } https://code.sololearn.com/cX8TmPAf63t4/?ref=app
12th Jul 2021, 6:29 PM
A͢J
A͢J - avatar
+ 2
Nick, Check the for loop, because the question is print from N to 1. I will suggest to write likes this. for(int timer = 1; n >= timer ; n--)
12th Jul 2021, 6:33 PM
JRAMAHES
JRAMAHES - avatar
+ 1
Replace "for(timer;timer!=0;--timer)" with "for(;timer!=0;--timer)", since 'timer' is already initialized. Also, be sure to capitalize your "Beep".
12th Jul 2021, 6:32 PM
Tactical Cat
Tactical Cat - avatar