in Education by
Write a program in Java to input any age and determine whether the age is valid or  invalid. If age is greater than or equal to 18 then it is valid otherwise invalid. Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Answer: public class Question { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println(“Enter Your Age“); int age = sc.nextInt(); if (age >= 18 ) { System.out.println(“Valid“); } else { System.out.println(“Invalid“); } } }

Related questions

0 votes
    write a program in Java to input a number and print if it is a special number or not. do this program using ... nested and while loop . Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    write a program to input a number. check and display whether it is divisible by 100 Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    write a program to input a year example 1994 and check whether it is a leap year Select the correct answer from above options...
asked Dec 6, 2021 in Education by JackTerrance
0 votes
    write a program to input a year example 1994 and check whether it is a leap year Select the correct answer from above options...
asked Dec 5, 2021 in Education by JackTerrance
0 votes
    write a program to input a year example 1994 and check whether it is a leap year Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
0 votes
    write a program to enter a sentence and check if it contains palindrome words or not. if yes then count and ... present. Java class 10 Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    Write a script in python to check whether your age is “major” or “minor” Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    java program to input any string then print each word along with their length Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
0 votes
    WRITE A PROGRAM TO READ DETAILS LIKE NAME, CLASS , AGE OF A STUDENT AND THEN PRINT THE DETAILS FIRSTLY IN ... THEN IN SEPERATE LINES Select the correct answer from above options...
asked Dec 30, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program to store the marks of any 5 subjects in different variables. Calculate total and average. ... ANY INPUT METHOD Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program to find the area and perimeter of a square and rectangle. Store side in s , length as ... USE ANY INPUT METHOD Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    write a program in python to enter the mark in 3 subjects and calculate total and assign grade. If total >= 200 ... grade is B' Select the correct answer from above options...
asked Nov 27, 2021 in Education by JackTerrance
0 votes
    If the mean and the variance of a binomial variable X are 2 and 1 respectively, then the probability that X takes a ... 7/8 D. 15/16 Select the correct answer from above options...
asked Nov 16, 2021 in Education by JackTerrance
...