Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


debashis mishra
automorphic no
1 Answer(s)      3 years and 3 months ago
Posted in : Java Beginners


write a program in java to find all the automorphic no's from 10 to 1000?


Advertisement
View Answers

January 13, 2011 at 3:17 PM


Hi Friend,

Try this:

class FindAutomorphicNumber {
     public static void main(String args[]) {
     long  num, n, sq, n1, n2;
System.out.println("Automorphic Numbers between 10 and 1000 are: ");
for (long i = 10; i < 1000; i++)
{
n = i;
sq = n*n;
while (n > 0)
{
n1 = n%10;
n2 = sq%10;
if (n1 != n2) break;
n = n/10;
sq = sq/10;
}
if (n == 0)
{
System.out.println(i);
}
}
}
}

Thanks



Related Tutorials/Questions & Answers:
automorphic no
automorphic no  write a program in java to find all the automorphic no's from 10 to 1000
automorphic numbers
automorphic numbers  how to find automorphic number in java   Hi Friend, Pleas visit the following link: Automorphic numbers Thanks
Advertisements
Java Find Automorphic numbers
Java Find Automorphic numbers In this section, you will learn how to find the automorphic numbers between 1 and 1000. Automorphic numbers are the numbers... square ends with the given integer. For example,5 is an automorphic number
Java Automorphic number program - Java Beginners
Java Automorphic number program  Write a program to read a positive integer from the console and find out whether it is automorphic or not. (Automorphic numbers are those which are found on the extreme right side
How to Check Automorphic Number using Java Program
How to Check Automorphic Number using Java Program Automorphic numbers... whose square ends with the given integer. For example,5 is an automorphic number.... Similarly 6 is an automorphic number as the square of 6 is 36 and its square consists
java - Java Beginners
and find out whether it is automorphic or not.(Automorphic number are those which...){ if ((n*n) % d == n){ System.out.println("Automorphic Number"); } else{ System.out.println("Not Automorphic Number"); } } else if(d<=n){ d=d*10; if ((n*n
Advertisements
 

 

 

DMCA.com