+ 1
What did i do wrong?
You need to make a countdown to 1. After numbers which multiple of five you need to print "Beep". I made code, but cannot find a mistake #include <iostream> using namespace std; int main() { int n; cin >> n; while(n > 0) { if(n % 5 == 4) { cout << "Beep" << endl; } cout << n << endl; n--; } return 0; }
10 Answers
+ 5
You need to print n first then print "Beep". // order you need.
For beep check current number. You are checking privous number in loop.
+ 2
https://code.sololearn.com/csVTefJ3fNxm/?ref=app Here is my code
+ 2
simply write the number before the beep
+ 2
Thank you! KrOW another time helped me. (Jayakrishna🇮🇳, thank you too )
+ 1
the module % operator is the integer remainder of division then the remainder for a n multiple of 5 has to be 0, not 4
+ 1
👍🏻
0
I know it, but if I write ' == 0' the word 'Beep' writes before numbers multiple of five
0
And my code completed four tests of five. I do not understand why
0
👍
0
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while(n > 0) {
cout << n << endl;
n--;
if(n % 5 == 4) {
}
}
cout<<"Beep";
return 0;
}