0

Can someone help me with this ?? Cause I can't produce 'Beep' in new line 😅

#include <iostream> using namespace std; int main() { int N; cin >> N; while(N>0){ cout << N; N--; cout <<endl; if(N%5==0){ cout << "Beep"; } } //your code goes here return 0; }

8th Jul 2021, 12:32 PM
Lucas Evergreen
Lucas Evergreen - avatar
3 ответов
+ 1
Thank You guys 😊😊
8th Jul 2021, 1:18 PM
Lucas Evergreen
Lucas Evergreen - avatar
0
Be careful that you're decrementing N before checking if it is divisible by 5 so to beep the input must be at least 6
8th Jul 2021, 12:42 PM
Angelo
Angelo - avatar
0
Lucas Evergreen Decrement N after checking condition because after printing 5, N will be 4 and 4 % 5 == 0 will be false. So "Beep" will not be print
8th Jul 2021, 1:16 PM
A͢J
A͢J - avatar