He help with c++ code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

He help with c++ code

Please help finish code I need to make a countdown and if the number is a multiple of 5 it says “Beep” after reporting the number. int main() { int n; cin >> n; for(n;n>=0;n--){ cout<<n<<endl; int y; y=n--%5; if(y==0){ cout<<"Beep"<<endl; } } return

12th Feb 2021, 4:13 PM
Dane
4 Answers
+ 1
This will be cleared code and without warnings: https://code.sololearn.com/c0k7xG5fMG5o/?ref=app
12th Feb 2021, 5:18 PM
JaScript
JaScript - avatar
+ 1
thanks. what if i still want it to post the number thats a multiole of 5. not replace 5, 10, 15 with beep but post the number then the line below beep. 15 beep 14 13
12th Feb 2021, 5:31 PM
Dane
+ 1
No problem Dane . Please see my updated code.
12th Feb 2021, 6:31 PM
JaScript
JaScript - avatar
0
You're unnecessarily subtracting from n in y= n-- % 5
12th Feb 2021, 4:33 PM
Mateusz Malenta
Mateusz Malenta - avatar