Last Updated: 14 March, 2023

On this tutorial page we are going to learn how to write a Java program to check whether number is automorphic or not.

An automorphic number is a number which is present in the last digit(s) of its square. In other words, an automorphic number is a number "n" such that "n^2" ends with "n".

For example, 5 is an automorphic number, since 5^2 = 25 and the last digit of 25 is 5. Similarly, 25 is also an automorphic number, since 25^2 = 625 and the last two digits of 625 are 25.

Here's a Java program to check if a given number is an automorphic number:

Example 1: Check number is Automorphic or not in Java

Output

76 is an Automorphic Number. 125 is not an Automorphic Number.

Example 2: Check number is Automorphic or not using Scanner Class

Output 1

Enter the number: 85 Not, It's not an Automorphic Number

Output 2

Enter the number: 625 Yes, It's an Automorphic Number.

Example 3: Print Automorphic Numbers between two numbers

Output

Print Automorphic Numbers between two different numbers Enter the starting number: 10 Enter the ending number: 1000 Automorphic numbers between 10 and 1000 are: 25 76 376 625

That's all guys, hope this Java Program is helpful for you.

Happy Learning... 😀

If you have any query or suggestion regarding this artical please share with us

`feedback@javabytechie.com`