0

Gotham City Challenge

Can anyone tell me where I’m going wrong? It’s says 2/5 cases have an error but won’t show me the input used. I am using C# using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int criminals; criminals = Convert.ToInt32(Console.ReadLine()); if (criminals < 5) { Console.WriteLine("I got this!"); } else if (criminals >= 5 && criminals <= 10) { Console.WriteLine("Help me Batman"); } else if (criminals > 10) { Console.WriteLine("Good luck out there!"); } } } }

5th Apr 2020, 10:24 AM
Musicdudejoe
7 Antworten
+ 1
Capitalize 'l' in "Good luck out there!" and the condition in the first else if statement should be criminals >= 5 && criminals < 10. You don't have to check if it is equal because that's for the third condition.
5th May 2020, 1:47 PM
Epsilon ︻╦̵̵͇̿̿̿̿╤──
Epsilon ︻╦̵̵͇̿̿̿̿╤── - avatar
+ 3
Where is your Code?
5th Apr 2020, 11:27 AM
A͢J
A͢J - avatar
+ 3
We can't see your Code through Code Coach Problem links. You have to share your Code here.
5th Apr 2020, 11:59 AM
A͢J
A͢J - avatar
0
I couldn’t find a way to put it in so I put the link
5th Apr 2020, 11:56 AM
Musicdudejoe
0
Maybe it's because you didn't give any value to criminals at first and it's null, make it int criminals = 0;
5th Apr 2020, 5:21 PM
Hadi Eini
Hadi Eini - avatar
0
No, gives same problem. It also wouldn’t have worked for the other 3 cases if it were that.
5th Apr 2020, 5:27 PM
Musicdudejoe
0
Whatever it it's, it's about convert.toInt32.. Use other convert methods
5th Apr 2020, 5:40 PM
Hadi Eini
Hadi Eini - avatar