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

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
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.