title: Find a leap year using a while or do-while loop
body: <p>I have an assignment to ask people to input a code and find out if it is a leap year. Whatever the outcome is it asks the person if they would like to try a new input. If the person answers yes it asks you to enter a new year. If the person says no it signs the code off by printing a goodbye.</p>
  <p>The only requirement is using a while or do-while loop. I am stuck.</p>
  <pre><code>import java.util.Scanner;
  
  public class homework7 {
  
      public static void main(String[] args) {
          Scanner scan = new Scanner(System.in);
          System.out.println(&quot;Enter a year: &quot;);
          int year = scan.nextInt();
          //while (yes==1) {
          do {
               /**System.out.print(&quot;Enter a year: &quot;); //prompting the user to enter information
               int year = scan.nextInt();*/
  
  
               if (year % 4==0) {
                   System.out.println(year + &quot; is a leap year&quot;); 
  
                   System.out.println(&quot;Would you like to check another year? Enter 1 for yes, 0 for no&quot;);
                   int yes = scan.nextInt();
                   
                  
  
               }
               else {
                   System.out.println(year + &quot; is not a leap year&quot;);
               }
          }
          
          while(year % 4==0); 
  
      }
  
  }
  
  </code></pre>
  <p>PS. Most importantly I'm stuck on figuring how to my the loop run again because I'm able to find out whether it is a leap year or not but when asked to continue I'm not sure how to make the input run again and ask the users for a new year!</p>