An Automorphic number is a number whose square ends with the same digits as the original number. E.g – 25, 76, 376 etc. ## Steps to Check Automorphic Number in Java

1. Take a number as input (num).
2. Square the number (sqr).
3. Count the number of digits of (num) using while loop (c).
4. Compare the last (c) digits of (sqr) with the (num).
5. If they are equal then the number is Automorphic else not.

Output

## Java Program to Find all Automorphic Numbers in the Interval

We know how to check whether a number is Automorphic or not using the above java program. Now, to find all Automorphic numbers in the given range, we need to define a function which returns true or false depending on whether the passed number as a parameter is automorphic or not. We will check for all the values in the given interval by passing it to the function one by one using loop.

Output

Any Doubts comment below.

### This Post Has 2 Comments

1. Soumojeet Ro Y

Can u please explain the process I can’t understand 😞🙏😔

1. To extract last ‘c’ digits we will use `sqr%(Math.pow(10,c)`.