fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. PrintWriter out = new PrintWriter(System.out);
  13. Scanner scanner = new Scanner(System.in);
  14. int N = scanner.nextInt();
  15. for (int d = 2; d < N / d; d++) {
  16. if (N % d == 0) {
  17. N = d;
  18. break;
  19. }
  20. }
  21. out.print(N);
  22. out.flush();
  23. }
  24. }
Success #stdin #stdout 0.1s 35548KB
stdin
9
stdout
9