0
Hey can you tell me what's wrong in this code?
#include <iostream> using namespace std; int main() { int n; cin >> n; //tu cĂłdigo va aquĂ while(n>=1){ if(n%5==0){ cout<<n<<endl; cout <<"beep"<<endl;} else{ cout<<n<<endl; } n-=1; } return 0; }
2 Answers
0
I vaguely remember that the word was "Beep" - with uppercase 'B' as first letter. Could it be?
0
The code is missing a closing brace '}' at the end of the while loop.
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
//tu cĂłdigo va aquĂ
while(n>=1){
if(n%5==0){
cout<<n<<endl;
cout <<"beep"<<endl;}
else{
cout<<n<<endl;
}
n-=1;
}
}
return 0;
}