paint-brush
How to Easily Check Whether a Number is Automorphic in Javaby@mayankvikash
443 reads
443 reads

How to Easily Check Whether a Number is Automorphic in Java

by Mayank Vikash5mDecember 6th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

There are several articles on how to check in Java whether a number is Automorphich or not. An Automorphic Number is a number whose square has the exact number as its last digit. With a loop check if the last digits of both numbers are the same or not can be checked with a simple condition `(n % 10 == sq % 10)’ With the help of a counter variable (here c) take a record of how many last digits are similar. Outside the loop, check with an if-else condition whether the counter variable is greater than 0.

Company Mentioned

Mention Thumbnail
featured image - How to Easily Check Whether a Number is Automorphic in Java
Mayank Vikash HackerNoon profile picture
Mayank Vikash

Mayank Vikash

@mayankvikash

Student with interest in tech

Learn More
LEARN MORE ABOUT @MAYANKVIKASH'S
EXPERTISE AND PLACE ON THE INTERNET.
0-item

STORY’S CREDIBILITY

Original Reporting

Original Reporting

This story contains new, firsthand information uncovered by the writer.

L O A D I N G
. . . comments & more!

About Author

Mayank Vikash HackerNoon profile picture
Mayank Vikash@mayankvikash
Student with interest in tech

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite