/** This program is intended to be used with the book "Java 6 -- What Do You Want To Do?"
 * by Steven P. Warr and is distributed free of charge and without and expectations of remuneration.
 * Chapter BAS   NOTE all programs begin with the title of the chapter in which
 * they are intended to be used.   Copyright 2008 Steven P. Warr All rights reserved
 */

import java.util.*;  		//needed for Scanner
public class Bas08
{
	public static void main(String[ ] args)
		{
			for (int x = 0 ;x<10 ; x++)
				{
					System.out.print(x + " ");
			    }
			int x = 15;  //initialize
			while (x > 0)  //terminate  //Notice  NO SEMICOLON here.
				{
					x--;  //increment
					System.out.println(x);
				}
			
			Scanner input = new Scanner(System.in);
			int num = 0;  //initialize
			do
				{
					System.out.println("Enter a number.  0 to quit");
					num = input.nextInt( );
					System.out.println(num + " times two is " + (num * 2));  // extra parentheses are 
			//needed.  Try it without them.
				}
			while (num != 0);  //Don’t forget the semicolon.
// NOTE uncomment this section to demonstrate an infinite loop (Highlight and press ctrl, shift and M simultaneously)				
//			for ( x = 0 ;     ; x++)    // Notice I left the terminator out. 
//				{
//					System.out.print(x + " ");
//			    }
		}			
}
