Write a java program to find out whether a number is an automorphic number .
Answers
here is your answer
hope this helps
❤❤❤❤❤❤
Sample program to check whether the number entered by user is automorphic:
import java.util.Scanner;
public class TechyPrince
{
public static void Brainly()
{
Scanner techy=new Scanner(System.in);
System.out.println("Enter a number that you want to check if its automorphic.");
int num=techy.nextInt();
int sq=0, b=0, c=1;
sq=num*num;
int d=num;
int l=num;
while(num!=0)
{
b++;
num=num/10;
}
for(int k=1;k<=b;k++)
{
c=c*10;
}
int dig=sq%c;
if(dig==d)
{
System.out.println("Entered number is an automorphic number.");
}
else System.out.println("Entered number is not an automorphic number.");
}
}
Output:
Enter a number that you want to check if its automorphic.
5
Entered number is an automorphic number.