0

How to solve the countdown problem?

How can i solve this : You need to make a countdown app. Given a number N as input, output numbers from N to 1 on separate lines. Also, when the current countdown number is a multiple of 5, the app should output "Beep". Sample Input: 12 Sample Output: 12 11 10 Beep 9 8 7 6 5 Beep 4 3 2 1

1st Jan 2021, 4:40 AM
Maruf Hasan
Maruf Hasan - avatar
1 Réponse
+ 7
Unfortunately, we cannot just give you the solution as we believe it will prevent you from learning. Try to attempt it, review your lessons. Show your attempt if you encounter bugs and errors so we may help you fix it. Thanks for understanding. but maybe these hints may help: --> You can use " for loop " to iterate all integers up to that number --> You can use modulo (%) operation to know if a number is a factor. For example: 24 % 8 == 0 // This means 8 is a factor of 24 because the remainder is 0. If you have more questions that may help you solve it, feel free to ask. Thanks and Happy Coding! https://www.sololearn.com/Discuss/1316935/welcome-to-sololearn-forum
1st Jan 2021, 4:46 AM
noteve
noteve - avatar