+ 1

Is the code projects for c++ bugged?

So I was solving one of the code projects for c++, when I was finished something weird happened The app shows me that I have mistakes, but when I see one of the test cases, my output and the expected output are the SAME! I also tried to close the app then open it again but it's still bugging, If you have an idea, please let me know! Here is my exact same code that I used In the code project: https://code.sololearn.com/cXmmVd70TT0M/?ref=app

11th Aug 2022, 1:41 AM
RayZ
RayZ - avatar
9 Answers
+ 2
Aji Ardiles just change b to B and it should pass
11th Aug 2022, 2:40 AM
BroFar
BroFar - avatar
+ 3
You're welcome Aji Ardiles
11th Aug 2022, 2:43 AM
BroFar
BroFar - avatar
+ 2
Chris Coder Countdown You need to make a countdown app. Given a number N as input, output numbers from N to 1 on separate lines. Also, when the current countdown number is a multiple of 5, the app should output "Beep". Sample Input: 12 Sample Output: 12 11 10 Beep 9 8 7 6 5 Beep 4 3 2 1 Hint: You can use the modulo operator % to check if a number is a multiple of 5. #include <iostream> using namespace std; int main() { int N; cin >> N; for ( int i = 0; N > 0; i++) { cout << N << "\n"; if (N%5 == 0){ cout << "Beep\n"; } N = N - 1; } return 0; }
11th Aug 2022, 2:29 AM
BroFar
BroFar - avatar
+ 2
Aji Ardiles remember beep is capitalized "Beep" and either version rather it is a "while" loop or a "for" loop should work
11th Aug 2022, 2:37 AM
BroFar
BroFar - avatar
+ 2
Chris Coder end of module project 21
11th Aug 2022, 2:38 AM
BroFar
BroFar - avatar
+ 2
BroFar ohh, that's it, I forgot to capitalize the b, thanks for the help!
11th Aug 2022, 2:42 AM
RayZ
RayZ - avatar
+ 1
Aji Ardiles try this instead #include <iostream> using namespace std; int main() { int n; cin >> n; while (n>0) { cout<<n<<"\n"; if (n%5==0){ cout<<"Beep"<<"\n"; } n--; //your code goes here } return 0; } Hope that helps.
11th Aug 2022, 2:03 AM
BroFar
BroFar - avatar
+ 1
Chris Coder Yeah it doesn't work. The output should count down from the number that has been in imputed, but that code starts below the number. But the project says that there should be a "beep" in every multiple of 5,. So we still need to print out "beep"
11th Aug 2022, 2:30 AM
RayZ
RayZ - avatar
+ 1
Chris Coder no I was working on project 21.
11th Aug 2022, 2:38 AM
RayZ
RayZ - avatar