AUTOMORPHIC NUMBER IN JAVA // BLUEJ HUB

AUTOMORPHIC

NUMBER IN JAVA //

BLUEJ HUB



=============================
import java.util.Scanner;
public class Automorphic
{
 public static void main(String args[])
{
 Scanner in = new Scanner(System.in);
 System.out.println("Enter a number");
 int num = in.nextInt();
 
 int c=0, sqr = num*num;
 int temp =num;  
 
while(temp>0)
{
   c++;
   temp=temp/10;
 }
 
 int lastSquareDigits = (int)
(sqr%(Math.pow(10,c)));      
 if(num == lastSquareDigits)
 System.out.println("Automorphic number");
 else
 System.out.println("Not an Automorphic
number");   }
}
}

=============================




Post a Comment

2 Comments

  1. Hii..
    My self nirupam roy .I read in class 10 icse.
    Computer is my one of the favourite subject.I was think i am join computer coaching but due to lockdown i don't go outside.I am very glad because there are many website on internet for help .
    This is very best website. These website help me a lot.I hope all of you enjoy.In these website all important question of programming solution are available

    ReplyDelete