-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYT51.java
More file actions
44 lines (33 loc) · 906 Bytes
/
YT51.java
File metadata and controls
44 lines (33 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*Automorphic Number: An Automorphic number is a number whose square “ends” in the same digits as the number itself.
Examples: 5*5 = 25, 6*6 = 36, 25*25 = 625
*/
import java.io.*;
public class YT51
{
public static void main(String[] args)throws IOException
{
int n;
int d, sq, c=0;
int ld=0;
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the number: ");
n=Integer.parseInt(br.readLine());
d=n;
sq=n*n;
while(n>0)
{
n=n/10;
c++;
}
ld=(int)(sq%Math.pow(10, c));
if(ld==d)
{
System.out.println("Auto");
}
else
{
System.out.println("Not");
}
}
}