text: Automorphic Number | C # program to check if a number is Authomorphic ; Function to check Automorphic number ; Store the square ; Start Comparing digits ; Return false , if any digit of N doesn ' t ▁ match ▁ with ▁ its ▁ ▁ square ' s digits from last ; Reduce N and square ; Driver Code
code: using System ; class GFG { static bool isAutomorphic ( int N ) { int sq = N * N ; while ( N > 0 ) { if ( N % 10 != sq % 10 ) return false ; N /= 10 ; sq /= 10 ; } return true ; } public static void Main ( ) { int N = 5 ; Console . Write ( isAutomorphic ( N ) ? " Automorphic " : " Not ▁ Automorphic " ) ; } }