JAVA CODE:
import java.util.Scanner;
class seriorcitizen{
public static void main(String args[])
{
int age;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the age of the person");
age=sc.nextInt();
if(age>=60)
{
System.out.println("The person is senior citizen");
}
else
{
System.out.println("The person not is senior citizen");
}
}
}
OUTPUT INPUT
1. Enter the age of the person = 67
The person is senior citizen
2.Enter the age of the person =50
The person is not a senior citizen
EXPLANATION
In this program we will see that how to find the senior citizen person using the java programing. In 1st line we have to import the Scanner function which is used to scanner the person age. At the next line the class is imported. At next age will be declared at the integer(int). At next the age was scanned using the scanner function. Using the if else statement we will check weather the age is greater than 60 or not. If the age is greater then 60 than it will say "The person is senior citizen". When the age was not greater than 60 then the else statement will be performed. In the else statement it will print that "The person is not senior citizen". This was the way to find the person is senior citizen or not using the java programing.
good and informative to hear about this new thing and am really excited to have lot many contents from you!!!.............
ReplyDeletePost a Comment