Computer Science, asked by ankitsimraj, 4 months ago

Write a program to compare the age of two people and print true if both are between 25-50 years of age, else print false

Answers

Answered by Aryabhatt007
0

Answer:

import java.util.*;

class compare

{

public static void main (String args[])

{

Scanner sc=new Scanner (System.in);

System.out.println("ENTER BOTH AGES");

int age1=sc.nextInt();

int age2=sc.nextInt();

if(age1>25 && age1<50)

{

if(age2>25 &&age2<50)

{

System.out.println("TRUE");

}

else

{

System.out.println("FALSE");

}

}

else

{

System.out.println("FALSE");

}

}

}

Similar questions