A number is a double digit number if it is greater than or equal to 10 and less than or equal 99. Similarly, a number is a triple digit number if it is greater than or equal to 100 and less than or equal 999. If it is neither of these two, then it falls into the other category.

Given below is the program

import java.util.Scanner; public class CountNumbers { public static void main(String[] args) { int doubleDigitNumbers = 0; int tripleDigitNumbers = 0; int otherNumbers = 0; Scanner scanner = new Scanner(System.in); System.out.println("Enter numbers (Type 0 to terminate): "); while (true) { int number = scanner.nextInt(); if (number == 0) { break; } if (number >= 10 && number <= 99) { doubleDigitNumbers++; } else if (number >= 100 && number <= 999) { tripleDigitNumbers++; } else { otherNumbers++; } } System.out.println("Double digit numbers = " + doubleDigitNumbers); System.out.println("Triple digit numbers = " + tripleDigitNumbers); System.out.println("Other numbers = " + otherNumbers); } }

Here is a sample output

Enter numbers (Type 0 to terminate): 9 98 745 983 0 Double digit numbers = 1 Triple digit numbers = 2 Other numbers = 1