import java.util.Scanner;

class Sep22 {
	public static void main(String[] args) {

		Scanner kb = new Scanner(System.in);

		// infinite loop with while-loop

/*
		while(1 == 1) {
			System.out.print("help!! ");
		}
*/
		// while loop that prints the integers from 1 to 10 (inclusively)

		int i = 1;
		while(i <= 10 ) {
			System.out.printf("%d ", i);
			i = i + 1;
		}
		System.out.println();

		// compute the sum of the values entered by the user until 
		// the user enters 0

		int sum = 0;
		int input = 1; 

		while (input != 0) {
			System.out.print("Enter integer: ");
			input = kb.nextInt();
			
			sum = sum + input;	
		}
		System.out.printf("sum: %d\n", sum);

		// print the odd values read from the keyboard until the user
		// enters 0.

		input = 1;
		
		while (input != 0) {
			System.out.print("Enter integer: ");
			input = kb.nextInt();

			if(input % 2 == 1) {
				System.out.printf("odd: %d\n", input);
			}
		}	
		System.out.println();


		// print the odd values read from the keyboard until the user
		// enters the retunr key.

		String val = "start";

		while(true) {
			System.out.print("Enter integer: ");
			val = kb.nextLine();

			try {
				input = Integer.parseInt(val);
			}
			catch(Exception e) {
				break;
			}

			if(input % 2 == 1) {
				System.out.printf("odd: %d\n", input);
			}
		}

		// count the number of integers the user enters that are odd
		// until the user enters 0

		input = 1;
		int count = 0;

		while(input != 0) {
			System.out.print("Enter integer: ");
			input = kb.nextInt();

			if(input % 2 == 1) {
				count = count + 1;

			}
		}
		System.out.printf("count: %d\n", count);

	}
}
