ICSE Class 10 Computer Applications Question 63 of 76

Revising Basic Java Concepts — Question 67

Back to all questions
67
Question

Question 44

Write a program that takes a number and check if the given number is a 3 digit number or not. (Use if to determine)

import java.util.Scanner;

public class Kboat3DigitNumber
{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter number: ");
        int n = in.nextInt();
        
        if (n >= 100 && n <= 999)
            System.out.println("Three Digit Number");
        else
            System.out.println("Not a three digit number");
    }
}
Output
BlueJ output of Kboat3DigitNumber.java
BlueJ output of Kboat3DigitNumber.java
Answer