C++ Countdown problem saying it's wrong despite correct code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ Countdown problem saying it's wrong despite correct code.

Hi, I'm stuck on the C++ Countdown Problem. My Output and Sample Output completely match and the code works but it says it's wrong. Here is my code: #include <iostream> using namespace std; int main() { int n; cin >> n; //your code goes here while(n > 0) { cout << n << endl; if (n % 5 == 0) { cout << "beep" << endl; } n--; } return 0; } Here is my output: 15 beep 14 13 12 11 10 beep 9 8 7 6 5 beep 4 3 2 1 Here is sample output: 15 Beep 14 13 12 11 10 Beep 9 8 7 6 5 Beep 4 3 2 1 Here is My output no. 2: 11 10 beep 9 8 7 6 5 beep 4 3 2 1 Here is sample output 2: 11 10 Beep 9 8 7 6 5 Beep 4 3 2 1 I am unable to see test cases 3, 4 and 5 but 3 and 5 say they are correct but 1, 3 and 4 say it's wrong. Any help appreciated

15th Jun 2022, 10:52 AM
MBA08
3 Answers
+ 4
MBA08 The sample output has a capital B for Beep. Your output shows beep with a small b. The challenges require an exact match to the challenge description
15th Jun 2022, 11:01 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Thanks, what a silly mistake of mine.
22nd Jun 2022, 2:45 PM
MBA08
0
Output is case sensitive, use capital B
16th Jun 2022, 5:18 PM
Stefan Corneteanu
Stefan Corneteanu - avatar