Exercises (Sections C.14–C.20)

C.22 Describe the four basic elements of counter-controlled repetition.

C.23 (Find the Smallest Value) Write an application that finds the smallest of several integers. Assume that the first value read specifies the number of values to input from the user.

C.24 Assume that i = 1, j = 2, k = 3 and m = 2. What does each of the following statements print?

a) System.out.println( i == 1 );

b) System.out.println( j == 3 );

c) System.out.println( ( i >= 1 ) && ( j < 4 ) );

d) System.out.println( ( m <= 99 ) & ( k < m ) );

e) System.out.println( ( j >= i ) || ( k == m ) );

f) System.out.println( ( k + m < j ) | ( 3 - j >= k ) );

g) System.out.println( !( k > m ) );

C.25 (Calculating the Value of π) Calculate the value of ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.