fork download
  1. import java.io.*;
  2. import java.util.*;
  3. public class Solution {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. int a = -4;
  7. if(a < 0) a = -a;
  8. int squareNum = a*a;
  9. int temp = a;
  10. int count = 0; // count of digit of a
  11. while(temp > 0){
  12. count++;
  13. temp = temp/10;
  14. }
  15. int lastDigit = squareNum%(int)Math.pow(10, count);
  16. // System.out.print(lastDigit);
  17. if(lastDigit == a) System.out.print("Automorphic");
  18. else System.out.print("Not Automorphic");
  19.  
  20. }
  21. }
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: error: class Solution is public, should be declared in a file named Solution.java
public class Solution {
       ^
1 error
stdout
Standard output is empty