Automorphic numbers are those which are found on the extreme right side of their square.For example : –
5=25
6=36
25=625
Hence,5,6,25 are Automorphic numbers.
import java.util.*;
public class Automorphic
{
public static void main (String args [])
{
int num,s;
int i,j,m,n,f;
int [] a=new int [10];
int [] b=new int [5];
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
System.out.println(“Enter number =”);
String x = input.readLine();
num = Integer.parseInt(x);
s = num*num;
i=0;
j=0;
f=0;
while(num !=0)
{
b[i] = num % 10;
num /=10;
++i;
}
while(s !=0)
{
a[j] = s % 10;
s /=10;
++j;
}
for(n = 0,m = 0, n < i;n++,m++)
{
if(a[m] ! = b[n])
f = 1;
}
if (f==0)
System.out.println(“Number is automorphic”);
else
System.out.println(“Number is not automorphic”);
}
}
In the above post we have discussed a java program of how to check whether a number is automorphic or not.For more such related posts or programing,gaming,technology related posts regularly visit our blog.
THANK YOU!!! FOR VISITING OUR BLOG.
Making money as a coder in 2025 is not much of a big or tough…
Lloyds Technology Centre, A tech and data company located in Hyderabad, India. They are part of…
How to Increase Height at Any Age Rise Above: How to Increase Height at Any…
In the fast-paced digital world, we often forget the timeless beauty that nature offers. Today,…
Top 10 Deadliest Kicks in Martial Arts: Master the Art of Knockouts Martial arts is…
How to Optimize Battery Life of Your Smartphone: Tips and Tricks for Prolonging Battery Health…