import java.util.Scanner; // bring in Scanner class so we can use it

public class While
  /** This class Introduces While Loop **/
  // loop tells jvm to execute statements repeatedly
{
  public static void main(String[] args)
  {  
    /* general format of a while loop:
     * 
    while (boolean expr)  {
      
      body of while loop
      
    }**/
    int num=1;
    while (num < 5) {  
      System.out.println("hello world");
      num++;
    }
    
    System.out.println("Counting down:");
    int count=5;
    while (count > 0) {
        System.out.print(count+" ");
        count--; 
    }
     // ask the user how many times 
    Scanner keyboard = new Scanner(System.in);
    System.out.print("\nHow many times should loop run?");
    count = keyboard.nextInt(); // read in count
    
    while (count > 0) {
        System.out.print(count+" ");
        count--; 
    }
  
  }
}
/******
LAB 6
Write a program to display the numbers from 1 to 10, each one
divided by 3. Use printf to format with exactly 3 digits after the
decimal point.
Use a while loop!
.333 .667 1.000 etc
*********/
