+ 1

Count Down protect

I have a problem with count down proyect in C++. I code this: //your code is here for(int i=n; i>=1; i--){ cout<< i >> endl; if(i % 5==0){ cout>>"beeb">>endl; } } //Why don´t work? someone explein me...

1st Oct 2022, 2:41 AM
Jacinto Vallejo
Jacinto Vallejo - avatar
7 Answers
+ 5
it would be: cout << i << endl; and it's probably 'beep' not 'beeb' cout << "beep" << endl; pay attention to the direction of the 'less than' signs
1st Oct 2022, 3:41 AM
Slick
Slick - avatar
+ 1
What a fool i am....
1st Oct 2022, 4:45 PM
Jacinto Vallejo
Jacinto Vallejo - avatar
+ 1
#include <iostream> using namespace std; int main() { int n; cin >> n; //tu código va aquí for (; n > 0; n--){ cout << n << endl; if (n % 5 == 0) cout << "beeb"<< endl; } return 0; }
1st Oct 2022, 4:48 PM
Jacinto Vallejo
Jacinto Vallejo - avatar
+ 1
Man this is another answer but itn's work yet
1st Oct 2022, 4:49 PM
Jacinto Vallejo
Jacinto Vallejo - avatar
+ 1
Ok thanks
1st Oct 2022, 4:53 PM
Jacinto Vallejo
Jacinto Vallejo - avatar
0
Yup, it doesn't work because you output "beeb". Output "beep" or whatever it says. Read carefully
1st Oct 2022, 4:51 PM
Slick
Slick - avatar
1
Error on the semantic, the correct is ' cout << i << endl; '
1st Oct 2022, 5:48 PM
Francisco Diêgo Pontes de Sousa
Francisco Diêgo Pontes de Sousa - avatar