title: how to get the closest number to zero in a loop
body: <p>I am trying to make a program that print the closest number to zero without using arrays I tried to print the minimum number as it will be the closest number to zero but this doesnot work when one of the numbers is negative  </p>
  
  <pre><code> public static void main(String[] args) {
      Scanner in = new Scanner(System.in);
  
      int n = in.nextInt();
      int t = 0;
      int min = Integer.MAX_VALUE;
      for (int i = 0; i &lt; n; i++) {
          t = in.nextInt();
          if (t &lt; min) {
              min = t;
          }
      }
      System.out.println(min);
  }
  </code></pre>