Automorphic Number Program in Java
In this section, we will learn automorphic numbers with examples and also create Java programs that check whether the number is automorphic or not.
What is an automorphic number?
A number is called an automorphic number if and only if the square of the given number ends with the same number itself. For example, 25, 76 are automorphic numbers because their square is 625 and 5776, respectively and the last two digits of the square represent the number itself. Some other automorphic numbers are 5, 6, 36, 890625, etc.
How to find automorphic number?
Follow the steps given below:
Java Automorphic Number Program
Automorphic Not Automorphic
Let's see another logic to check the number is automorphic or not.
Enter a number to check: 625 625 is an automorphic number.
Enter a number to check: 312 312 is not an automorphic number.
Let's create a Java program that determines all the automorphic numbers within a specified range.
Enter the starting value: 1 Enter the ending value: 10000 Automorphic numbers between 1 and 10000 are: 1 5 6 25 76 376 625 9376
Next TopicJava Atomic