0

I don't know why there is error showing in this program I'm stuked with it from last few hours

//here is the program import java.util.Scanner; public class detection { public static void main(String args[]) { Scanner sc=new Scanner(System.in); System.out.println("enter your age"); int a=sc.nextInt(); System.out.println("enter your age"); int b=sc.nextInt(); System.out.println("enter your age"); int c=sc.nextInt(); if(a>b && a>c) { System.out.println("oldest is "+a); } else if(b>c && b>a) { System.out.println("oldest is "+b); } else { System.out.println("oldest is "+c); } if(a<b && a<c) { System.out.println("youngest is "+a); } else if(b<c && b<a) { System.out.println("youngest is "+b); } else { System.out.println("youngest is "+c); } } } https://code.sololearn.com/c3s4l0cTh6jG/?ref=app https://code.sololearn.com/cNcN2gxyxeKw/?ref=app

3rd Aug 2019, 6:48 AM
Anjali Shaw
Anjali Shaw - avatar
9 Respuestas
+ 1
just a few typos in the 2nd code https://code.sololearn.com/cq6A0sc4lUoC/?ref=app
3rd Aug 2019, 6:51 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 1
I got that... Thanks!
3rd Aug 2019, 7:07 AM
Anjali Shaw
Anjali Shaw - avatar
0
Thanks...
3rd Aug 2019, 6:53 AM
Anjali Shaw
Anjali Shaw - avatar
0
But what is wrong when I'm writing +a+b+
3rd Aug 2019, 6:54 AM
Anjali Shaw
Anjali Shaw - avatar
0
But we write as System.out.println("oldest is" +a) ; For printing value of a and there it shows no problem
3rd Aug 2019, 7:03 AM
Anjali Shaw
Anjali Shaw - avatar
0
Ohh thanks!
3rd Aug 2019, 7:08 AM
Anjali Shaw
Anjali Shaw - avatar