Computer Science, asked by Anonymous, 9 months ago

write a program to input automorphic number using scanner class only. ​

Answers

Answered by Anonymous
1

Java Code:

import java.util.Scanner;

public class Example14 {

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.");

}

}

HOPE IT HELPS

Similar questions