Automorphic Number Program in Java3 May 2025 | 3 min read In 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 |
Java program to print the following pattern on the console In this program, we are creating a right-angled triangle of numbers in increasing order. We are creating two loops, and 2nd loop is executing according to the first loop, inside 2nd loop printing the number row-wise...
2 min read
Java String to float We can convert String to float in java using Float.parseFloat() method. Scenario It is generally used if we have to perform mathematical operations on the string that contains float number. Whenever we get data from textfield or textarea, entered data is received as a string....
1 min read
Selection sort is an easy-to-understand and straightforward kind of algorithm that sorts elements in a list or array, either ascending or descending. The element idea at the core of selection sort is to obtain repeatedly the minimum (or the maximum) element of the unsorted part...
7 min read
Problem Statement The problem states that a gardener wants to water a garden (single-dimensional) by opening the minimum number of taps. The task is to find the minimum number of taps that should be open to water the whole garden, return -1 if the garden cannot be...
17 min read
Program to print the largest element in an array In this program, we need to find out the largest element present in the array and display it. This can be accomplished by looping through the array from start to end by comparing max with all the...
2 min read
An array containing various numbers is given. The task is to create different groups, each containing only two elements, such that the difference between the group containing the largest sum and the group containing the lowest sum should be minimum. Note that any element can only...
5 min read
In this program, our task is to remove all the white-spaces from the string. For this purpose, we need to traverse the string and check if any character of the string is matched with a white-space character or not. If so, use any built-in method...
2 min read
A binary tree is given whose edges are undirected and whose nodes are connected. Also, the tree is not cyclic. The binary tree is made up of t nodes that are numbered from 0 to t - 1 and have exactly t - 1 edge. Every...
21 min read
Write a code to prove that strings are immutable in java? Following program demonstrate it. File: ProveStringImmutable .java public class ProveStringImmutable { public static void referenceCheck(Object x, Object y) { if (x == y) { System.out.println("Both pointing to the same reference"); } else { System.out.println("Both are pointing to different reference"); } } public static void...
1 min read
In this program, we will create a doubly linked list and delete a node from the end of the list. If the list is empty, print the message "List is empty". If the list is not empty, tail's ious node will become the new tail...
6 min read
We request you to subscribe our newsletter for upcoming updates.
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