title: how to fix infinite loop in my java program
body: <p>i'm trying to write a program that can convert seconds into days, hours, minutes, seconds. But I am trying to make it loop so that once converted the program will prompt the user to enter another number of seconds, or if the number is negative end the program. So far, my problem seems to be with my while loop since the number of seconds isnt necessarily 0 it keeps trying to solve and prompt. Here is my code:</p>
  
  <pre><code>import java.util.*;
  public class Probleme3 
  {
  public static void main(String[] args)
  {
      Scanner in = new Scanner(System.in);
      System.out.print("Input seconds :");
      int sec = in.nextInt();
      int min;
      int heure;
      int jour;
  
      while(sec != 0)
      {
          if(sec &lt; 0)
          {
          }
  
          else
          {
          min = sec /60;
          sec = sec % 60;
          heure = min /60;
          min = min % 60;
          jour = heure /24;
          heure = heure % 24;
  
  
          System.out.println( jour + ":" + heure + ":" + min + ":" + sec);
  
          System.out.println("Input seconds :");
      }
      }   
  }
  }
  </code></pre>