What's wrong with this code it gave the right output but they didn't accept it | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

What's wrong with this code it gave the right output but they didn't accept it

#include <iostream> using namespace std; int main() { int n; cin >> n; while(n>=1) { cout<<n<<endl; if(n%5==0) { cout<<"beep"<<endl; } n--; } return 0; }

2nd Apr 2021, 8:31 AM
Maria Shogh
Maria Shogh - avatar
3 Réponses
+ 2
The worst enemy in coding is mistyping, and you can sometimes use a hell of a time to locate a letter that should have been uppercase or a wrong number in calculations that causes a wrong output.
2nd Apr 2021, 10:14 AM
Jan
Jan - avatar
+ 8
You are supposed to print "Beep" with a capital 'B', that's all.
2nd Apr 2021, 8:33 AM
Shadow
Shadow - avatar
0
Ohh i spent 20 minutes to find the mistake🤦😂 thank you so much
2nd Apr 2021, 10:24 AM
Maria Shogh
Maria Shogh - avatar