write a program to check whether the person is adult or not
Answers
Answered by
11
import java.io.*;
class check
{
public static void main(string args[])
{
scanner sc=new scanner(System.in);
string n;
int a;
System.out.println("Enter your name");
n=sc.nextLine();
System.out.println("Enter your age");
a=sc.nextInt();
if(a>=18)
System.out.println(n+"is adult");
else
System.out.println(n+"is not adult")
}||end of main
}||end of class
HOPE IT HELP YOU
class check
{
public static void main(string args[])
{
scanner sc=new scanner(System.in);
string n;
int a;
System.out.println("Enter your name");
n=sc.nextLine();
System.out.println("Enter your age");
a=sc.nextInt();
if(a>=18)
System.out.println(n+"is adult");
else
System.out.println(n+"is not adult")
}||end of main
}||end of class
HOPE IT HELP YOU
pragya6392:
fine
Answered by
12
This is for QBasic and QB64. This is a very easy method. You can change what is there in print.
CLS
INPUT "WHAT IS YOUR AGE? ";Y
IF Y < 18 THEN PRINT " YOU ARE NOT YET AN ADULT " ELSE PRINT " YOU ARE AN ADULT"
END
Similar questions