fork download
  1. import java.util.Scanner;
  2.  
  3. class Ideone {
  4.  
  5. public static void main(String args[]) {
  6. Scanner sc = new Scanner(System.in);
  7. int n = sc.nextInt();
  8. int c = 5526;
  9. int inp;
  10. for (int a = 0; a < n; a++) {
  11. inp = sc.nextInt();
  12. if (Math.abs(inp) < Math.abs(c)) {
  13. c = inp;
  14. }
  15. }
  16. System.out.print(c);
  17. }
  18. }
Success #stdin #stdout 0.1s 51484KB
stdin
3
-12 -5 -137
stdout
-5