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!"); } } } }
7 Respostas
+ 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.
+ 3
Where is your Code?
+ 3
We can't see your Code through Code Coach Problem links. You have to share your Code here.
0
I couldnât find a way to put it in so I put the link
0
Maybe it's because you didn't give any value to criminals at first and it's null, make it int criminals = 0;
0
No, gives same problem. It also wouldnât have worked for the other 3 cases if it were that.
0
Whatever it it's, it's about convert.toInt32..
Use other convert methods