import java.util.Scanner;

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

		Scanner kb = new Scanner(System.in);

		System.out.print("Enter 0 to stop, any other int to continue: ");

		int input = kb.nextInt();

/*
		String option = "";

		if (input == 0) {
			option = "Stop";
		}
		else {
			option = "Continue";
		}
*/
		option = (input == 0) ? "Stop" : "Continue";  // equivalent to above if-else blocks

		System.out.println("Option: " + option);

		boolean flag = true;
		System.out.println(!flag);	

		/*** Print all odd elements in array */
		int[] arr = { 1,2,3,4,5 };

		for(int i = 0; i < arr.length; i++) {
			if (!(arr[i] % 2 == 0)) {
				System.out.printf("%d ", arr[i]);
			}
		}
		System.out.println();

		/*** sum up elements in an array using method */
		int returnedValue = sumArray(arr);
		System.out.printf("Sum: %d\n", returnedValue);

		/*** Use switch statement */
		System.out.print("Enter 1-3: ");
		input = kb.nextInt();

		switch(input) {
			case 1:
				System.out.println("Input is 1");
				break;
			case 2:
				System.out.println("Input is 2");
				break;
			case 3:
				System.out.println("Input is 3");
				break;
			default:
				System.out.println("Input is other");
		}

		// set array elements to multiples of 100
		for(int i = 0; i < arr.length; i++) {
			arr[i] = 100 * (i + 1);
		}

		for(int i = 0; i < arr.length; i++) {
			System.out.printf("%d ", arr[i]);
		}
		System.out.println();
	
		int x = 57000000;
		while(x >= 1) {
			System.out.printf("%d ", x);
			x = x - 100;
		}	

	}

	public static int sumArray(int[] passedIn) {

		int sum = 0;
		for(int i = 0; i < passedIn.length; i++) {
			sum = sum + passedIn[i];
		}
		
		return sum;
	}


}
