Computer Science, asked by KKarun45, 1 year ago

write a program to check whether the person is adult or not​

Answers

Answered by pragya6392
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

pragya6392: fine
pragya6392: Lucknow
pragya6392: Pragya Vardhan
KKarun45: n8ce thanks for helped
pragya6392: wlcm
Answered by Queengreen21
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