+ 2

Please tell me what is the mistake, I am not able to insert Beep| c++ second in session challenge countdown

#include <iostream> using namespace std; int main() { int n,x; cin >> n; while(n>0){ cout<<n<<endl; x=n%5; if(x=0) cout<<"Beep"; n--; } return 0; }

19th Nov 2020, 11:25 AM
Rohitashav Gehloch
Rohitashav Gehloch - avatar
1 Odpowiedź
+ 7
You used the assignment operator = inside the if-statement, but if you want to compare two values, you need to use the comparison operator == instead.
19th Nov 2020, 11:28 AM
Shadow
Shadow - avatar