+ 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
3 Antworten
+ 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
+ 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--)
+ 1
Replace "for(timer;timer!=0;--timer)" with "for(;timer!=0;--timer)", since 'timer' is already initialized. Also, be sure to capitalize your "Beep".