+ 1
Same result wrong answer on c++ project
I'm getting the answer right on second project of c++, "countdown", spite of getting the exact same result the test cases still check it wrong. Code: #include <iostream> using namespace std; int main() { int n; cin >> n; //tu cĂłdigo va aquĂ do { if ( n % 5 == 0 ){ cout << n << "\n" << "Beep \n" ; } else if (n == 1) { cout << n; } else { cout << n << "\n" ; } n-- ; } while (n > 0) ; return 0; }
3 Answers
+ 2
Check the output clearly..
if input 7
It asked to print
7
6
5
Beep//no space after it, and print after the number
4
3
2
1
+ 1
Thanks, that worked, still, now it looks like:
15
Beep14
13
12
...
The test cases proved it correct now, even tho is showing the expected results as having a new line every number, I think this is an oversight either on the expected result or how is presented the students code
+ 1
if( num%5==0 )
cout<<"Beep"<<endl;
hope that pass all tests...
you're welcome..