EXAMPLE:

the leftmost digit is divisible by 1 and

the leftmost two digits are divisible by 2 and

the leftmost 3 digits are divisible by 3 and

the leftmost 4 digits are divisible by 4 and

leftmost 5 digits (the five-digit number itself) is divisible by 5.

import java.util.Scanner; public class Main { public static void main(String[] args) { int numbSize; int numb; int numbLarge=-1; Scanner myScan = new Scanner(System.in); System.out.print("Enter 5 digit number: "); numb = myScan.nextInt(); numbSize = String.valueOf(numb).length(); if (numbSize != 5) { System.out.println("This is not a 5 digit number"); } } }

This post has been edited by **modi123_1**: 10 March 2020 - 10:50 AM

Reason for edit:: In the future please use the [code] tags in the editor.