An Automorphic number is a number whose square ends with the same digits as the original number. E.g – 5, 6, 76 etc.

Automorphic numbers

Steps to Check Automorphic Number in C:

  1. Take a number as input (num).
  2. Count number of digits in the number (n)
  3. Find Square of the number (sqr).
  4. Extract last n digits from the sqr (last).
  5. If last == num then number is Automorphic else not.

Here is the implementation of the steps in C.

Output

Automorphic Number in C

Find all Automorphic Numbers in the Interval

Output

Automorphic numbers from 1 to 1000 in C

In this tutorial, we have learned to check automorphic in C.

Leave a Reply