+ 1
C++ simple assignment
problem: 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". new learner here I manage to countdown the n to 1 but I struggling in how i will put the beep. Please help. This is what I done int n; cin >> n; do { cout << n << "\n"; n--; }while (n >= 1);
2 Respostas
+ 4
You need to add condition inside loop like this
If number is divisible by 5 then print beep
if num%5==0 // remainder zero it's multiple of 5
Print beep
0
thank you it worked