Write a program in java to input integer and check whether it is a 4digit number or not
Answers
Answered by
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
Social Sciences,
6 months ago
Environmental Sciences,
6 months ago
Math,
6 months ago
Math,
1 year ago
Math,
1 year ago
Math,
1 year ago