Betty sought your help to find ‘N’.

 



import java.util.*;

class TestClass {
public static void main(String args[] ) throws Exception {

Scanner s = new Scanner(System.in);
int n = s.nextInt();
String output="";

if(n>=1 && n<=100)
{
char[] inputAry = new char[n];

for(int i=0;i<inputAry.length;i++)
{
inputAry[i] = s.next().charAt(0);
}
for(int i=0;i<inputAry.length;i++)
{
if(((int)inputAry[i]) == (int)'N')
{
output = "Found it!";
}
}
}
if(output == "" ){
output = "Sorry!";
}
System.out.println(output);
}
}

Comments