Same result wrong answer on c++ project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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; }

10th Feb 2022, 3:17 PM
Diego Ulloque
Diego Ulloque - avatar
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
10th Feb 2022, 3:24 PM
Jayakrishna 🇮🇳
+ 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
10th Feb 2022, 3:31 PM
Diego Ulloque
Diego Ulloque - avatar
+ 1
if( num%5==0 ) cout<<"Beep"<<endl; hope that pass all tests... you're welcome..
10th Feb 2022, 3:42 PM
Jayakrishna 🇮🇳