Automorphic Number Program in JavaIn this section, we will learn automorphic numbers with examples and also create Java programs that check whether the number is automorphic or not. What is an automorphic number?A number is called an automorphic number if and only if the square of the given number ends with the same number itself. For example, 25, 76 are automorphic numbers because their square is 625 and 5776, respectively and the last two digits of the square represent the number itself. Some other automorphic numbers are 5, 6, 36, 890625, etc. How to find automorphic number?Follow the steps given below:
Java Automorphic Number ProgramAutomorphicNumberExample1.java Output 1: Automorphic Not Automorphic Let's see another logic to check the number is automorphic or not. AutomorphicNumberExample2.java Output 1: Enter a number to check: 625 625 is an automorphic number. Output 2: Enter a number to check: 312 312 is not an automorphic number. Let's create a Java program that determines all the automorphic numbers within a specified range. AutomorphicNumberExample3.java Output: Enter the starting value: 1 Enter the ending value: 10000 Automorphic numbers between 1 and 10000 are: 1 5 6 25 76 376 625 9376 Next TopicJava Atomic |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India