- 1

Help ! help to solve my code

Question👇 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 This is my code👇 #include <iostream> using namespace std; int main() { int n; cin >> n; for(int i=n;i>0;i--){ if(i%5==0){ cout<<i<<"\nBeep "<<endl; } else{ cout <<i<<endl; } } //your code goes here return 0; }

15th Jul 2021, 9:36 AM
MOHAMED THOUFIC YOUSUF
2 Answers
+ 2
You need to remove the space between p and " \"nBeep"
15th Jul 2021, 9:45 AM
Simba
Simba - avatar
+ 1
Thank you so much
15th Jul 2021, 10:12 AM
MOHAMED THOUFIC YOUSUF