Is there anyone help me to write a code for this problem please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there anyone help me to write a code for this problem please

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".

14th Dec 2020, 1:14 PM
Liulekal Engida
Liulekal Engida - avatar
4 Answers
+ 2
abel p Yes we can help but show attempts.
14th Dec 2020, 1:19 PM
A͢J
A͢J - avatar
+ 2
abel p There is no n multiple of 5. This is not an exam where you can write anything and get number. It's a programming. You need to learn. Use for loop or while loop and print number in reverse order and also check if number % 5 == 0 and print "Beep" if condition is satisfied. Complete the course, do more practice and then solve problem.
14th Dec 2020, 1:30 PM
A͢J
A͢J - avatar
+ 1
The question means to output number from N to 1, where N is user's input. So you need a loop to output the numbers counting down N times. Also, to check weather the number is multiple of 5, you can check if the number's remainder is 0.
14th Dec 2020, 1:34 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
#include <iostream> using namespace std; int main() { int n; cin >> n; //your code goes here if ( n <=15 && n multiple of 5 ) { cout << "beep"; } return 0;
14th Dec 2020, 1:23 PM
Liulekal Engida
Liulekal Engida - avatar