Computer Science, asked by clintonghosh777, 1 year ago

Write a program in java to input integer and check whether it is a 4digit number or not​

Answers

Answered by mayanksharma789594
5

Explanation:

import.java.util.scanner;

class four

{

public static void main (string args[])

{

int num;

Scanner in = new Scanner(System.in);

System.out.println("Enter an integer Number: ");

num = in.nextInt();

if(num>=1000)&&(num<=9999)

{

System.out.println("Number is a four digit number");

}

else

{

System.out.println("Number is not a four digit number");

}

}

}

Output:-

Enter an integer Number: 5555 <-|(enter)

Number is a four digit number

Similar questions