Computer Science, asked by shiva735, 8 months ago

Write a program in Java to check automorphic​

Answers

Answered by aman7913
4

println(number+" is not a automorphic number"); } } public static void main(String args[])

...

Implementation of this concept is shown below :

◾import java. util. Scanner;

◾class example.

◾{

◾static void check(int number)

◾{

◾int unit_digit1=number%10;

◾int square=number*number;

◾int unit_digit2=square%10;

_____________________________

hope it helps you..

Answered by anindyaadhikari13
30

Here is your answer.

<hr/>

import java.util.Scanner;

public class Program {

public static void main(String args[])

{

Scanner sc = new Scanner(System.in);

System.out.print("Input a number : ");

int num = sc.nextInt();

int sq_num = num*num;

String str_num = Integer.toString(num);

String square = Integer.toString(sq_num);

if(square.endsWith(str_num))

System.out.println("Automorphic Number.");

else

System.out.println("Not an Automorphic Number.");

}

}

<hr/>

Similar questions