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
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
Computer Science,
2 months ago
Hindi,
2 months ago
Environmental Sciences,
2 months ago
English,
11 months ago
Social Sciences,
11 months ago
English,
11 months ago