write a program to input a number and check whether it is a three digit number or not (in java)
Answers
Answer:
import java.io.*;
class digit
{
public static void main()throws IOException
{
BufferedReader br=new BufferedReader
(new InputStreamReader (System.in));
System.out.println("ENTER NUMBER");
int num=Integer.parseInt(br.readLine());
if(num>=100 && num<=999)
System.out.println("THREE DIGIT NUMBER");
else
System.out.println("NOT A THREE DIGIT NUMBER");
}
}
Explanation:
mark me as brainliest please
Answer: The required java program is :-
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter an integer : ");
int num = scan.nextInt();
if(num>=100 && num<=999){
System.out.println("The number "+num+" is a three digit number.");
}
else {
System.out.println("The number "+num+" is not a three digit number.");
}
}
}
Please mark it as Brainliest.