C++ SOLOLEARN COMPILER | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

C++ SOLOLEARN COMPILER

I was trying to complete a module project in c++. The problem to solve was "to output the word beep if the number is a multiple of 5". Ok my code is as follows: int n; cin >> n; //your code goes here for (int i =n ; i > 0; i--) { cout <<n<<endl; if( i % 5 ==0 ){ cout<<"beep"<<endl; } } I am certain that the above code is correct however when I run it. It says it's wrong. I run the same come in a IDE and it works. So I think the sololearns compiler is the problem. IF SOMEONE DID THIS SAME PROBLEM LET ME KNOW HOW YOU DID IT

10th Mar 2021, 4:52 AM
Steven J Suß
Steven J Suß - avatar
3 Antworten
+ 3
According to the question you have to display word "Beep" ( note the capital *B*) in the output not "beep".
10th Mar 2021, 4:57 AM
Arsenic
Arsenic - avatar
+ 2
You are outputting additional 'n' number, when you have to output "Beep" only according to the question
10th Mar 2021, 5:46 AM
Michal Doruch
+ 1
Never mind. I ascertained the error. 🤣it was a simple mistake.
10th Mar 2021, 5:53 AM
Steven J Suß
Steven J Suß - avatar