
import java.util.Scanner;

public class MoreLoops {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		//do-while loop
		System.out.print("How far will we count? ");
		int max = input.nextInt();
		
		//counting loop
		//count from 1 to max
		int count = 1;  //start
		
		//the body is executed at least once
		do {
			System.out.println(count); //repeat this
			count++;  //next
		} 
		while(count <= max);  //condition
		
		//sentinel loop - repeating until a special value or condition
		// is met
		//enter numbers until the user types 0
		
		int sum = 0;
		
		int number = 0;  // stores user input
		
		do {
			sum += number;  //repeat
			
			//next
			System.out.print("Enter an integer (0 to quit): ");
			number = input.nextInt();
			
		} while(number != 0); //keep going until we get to the sentinel

		System.out.println("The sum is " + sum);
		
		System.out.println("test" + sum + number);
		System.out.println(sum + number + "test");
	}

}
