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
andm = 2
. What does each of the following statements print?System.out.println( i == 1 );
System.out.println( j == 3 );
System.out.println( ( i >= 1 ) && ( j < 4 ) );
System.out.println( ( m <= 99 ) & ( k < m ) );
System.out.println( ( j >= i ) || ( k == m ) );
System.out.println( ( k + m < j ) | ( 3 - j >= k ) );
System.out.println( !( k > m ) );
-
C.25 (Calculating the Value of π) Calculate the value of π from ...
Get Android How to Program, 3/e 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.