+ 1

How to pass batman gotham city 5th case

Below is the code please inspect:: using System; namespace SoloLearn { class Program { static void Main(string[] args) { int input = Int32.Parse(Console.ReadLine()); if(input > 0 && input <5) Console.WriteLine("I got this!"); else if(input >= 5 && input <10) Console.WriteLine("Help me Batman"); else if(input >= 10) Console.WriteLine("Good Luck out there!"); else Console.WriteLine("Nothing to worry about"); } } }

19th Jan 2020, 4:54 AM
Abhishek Pun
Abhishek Pun - avatar
4 odpowiedzi
+ 2
Abhishek Pun 1) there are only three outputs: Output Format: A string that says 'I got this!', 'Help me Batman', or 'Good Luck out there!' depending on the scenario. 2)Check your conditions (if-else)
19th Jan 2020, 7:07 AM
Daljeet Singh
Daljeet Singh - avatar
+ 1
Here’s a simple solution for C#: https://code.sololearn.com/c970V7kNTGPp/?ref=app
6th Feb 2020, 9:29 PM
Håkon T
Håkon T - avatar
0
Hi abhishek in second condition make input<=10. I cleared all the test cases with the following code import java.*; import java.util.Scanner; class Batman { public static void main(String arg[]) { int criminal=0; Scanner sc=new Scanner(System.in); criminal=sc.nextInt(); if(criminal<5) { System.out.println("I got this!"); } else if(criminal>=5 && criminal<=10) { System.out.println("help me out Batman"); } else { System.out.println("Good luck out there!"); } } }
22nd Jan 2020, 4:56 AM
kartik narang
kartik narang - avatar
0
1. Why the hell is there a fourth statement? 2. Convert.ToInt32(Console.ReadLine()); not Int32.Parse. 3. Just put an else statement on the second else if statement. 4. input < 5 in if statement condition.
5th May 2020, 1:50 PM
Epsilon ︻╦̵̵͇̿̿̿̿╤──
Epsilon ︻╦̵̵͇̿̿̿̿╤── - avatar