Comp 110 Practice Problems for Final Exam 1) Write the following 'while' loop using 'for' loop int count = 0; int sum = 0; while( count < 10 ) { sum += count; count++; } 2) What is the output from each code segment? int sum = 0; for( int i = 0; i < 5; i++ ) { sum = sum + i; for( int j = 0; j < 5; j++ ) sum = sum + j; } System.out.println(sum); int sum = 0; for( int i = 0; i < 5; i++ ) { sum = sum + i; for( int j = i; j < 5; j++ ) sum = sum + j; } System.out.println(sum); 3) Display the first n numbers in the Fibonacci sequence. The sequence starts with the following numbers: 1,1,2,3,5,8,12,21 After the initial two 1s, each number in the sequence is the sum of the two prvious numbers. 4) Read a sequence of positive numbers from the keyboard. Display first the largest and then smallest number entered. Entering a negative number signals the end of the input. For example, the input sequence 13 12 66 91 -999 produces the output 12 91