write a program in JAVA to input the age of three person then find out who is eldest ?? my question is .... if we the age of two person is equal and greater than the third then how would the program look like ??
Answers
Answered by
1
Answer:
sorry but I have just started learning Java Programs.
Answered by
2
Answer:
import java.util.Scanner;
class hi{
public static void main(){
Scannet ob=new Scanner(System.in);
System.out.println("enter the age of the first person");
int a=ob.nextInt();
System.out.println("enter the age of the second person");
int b=ob.nextInt();
System.out.println("enter the age of second person");
int c=ob.nextInt();
if(a>b&&a>c)
System.out.println("first person is eldest");
else if(b>a&&b>c)
System.out.println("second person is eldest");
else
System.out.println("third person is eldest");
}}
//(please check that the program dosnt contain any error)
Similar questions