A delightful Automorphic number
For other java programs clickhttps://wordpress-343193-1101484.cloudwaysapps.com/patterns-part-4strings
A number is called an Automorphic number if its square ends in the same digits as the number itself.
For example, N=6 is an automorphic number because 6*6=36
N=25 is an automorphic number because 25*25=625
For other java programs click
Pattern programs in java part 1: Simple loop programs
Write a program to accept a number and print whether it is an automorphic number or not.
import java.io.*;
class automorphic//one whose square ends in the same digits as the number itself e.g., 25
{
public static void main() throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a number");
int num=Integer.parseInt(br.readLine());
int pro=(int)Math.pow(num,2);
if(pro%10==num||pro%100==num)
{
System.out.println("AN Automorphic Number");
}
else
{
System.out.println("Not An Automorphic Number");
}
}
}Output:
Enter a number
6
AN Automorphic Number
for more videos related to java click https://www.youtube.com/user/trushnatej
Related Posts
Continue learning with these related articles

String Methods in Java for ICSE Class 10: 25 Output Questions with Answers
ICSE Class 10 Computer Applications practice on String class methods: length, charAt, indexOf, lastIndexOf, substring, replace, trim, compareTo, equals and more, with 25 board-style output questions and step-by-step answers.

Special Number Programs in Java for ICSE: Armstrong, Spy, Neon, Disarium, Pronic and More
Every special number asked in ICSE Computer Applications – prime, perfect, Armstrong, palindrome, automorphic, neon, spy, Niven, duck, buzz, Disarium, special and pronic numbers – with definitions, examples and one complete Java program that checks them all.

Math Library Methods in Java for ICSE Class 9 (with Outputs)
ICSE Class 9 Computer Applications notes on the Java Math class: sqrt, cbrt, pow, abs, max, min, ceil, floor, round, rint and random, with return types, tricky negative-number outputs and Java expressions for formulas.