Computer Science, asked by eakshithkarri, 6 months ago

write a java program to accept a number and check wether it is four digit or not​

Answers

Answered by shailkanch25
1

import java.util.*;

public static void main(String[] args)

{

Scanner sc= new Scanner(System.in); //System.in is a standard input stream.

System.out.print("Enter number- ");

int a= sc.nextInt();

if (a<10000 && a>999)

system.out.println("number is 4 digit integer");

else

system.out.println("number is not 4 digit integer");

}

Answered by nishitagirish74
0

Answer: import java.util.*;

public static void main(String[] args)

{

Scanner sc= new Scanner(System.in); //System.in is a standard input stream.

System.out.print("Enter number- ");

int a= sc.nextInt();

if (a<10000 && a>999)

system.out.println("number is 4 digit integer");

else

system.out.println("number is not 4 digit integer");

}

Explanation:

Similar questions