Posted by: Chyne on: October 10, 2008
/* Exercise 5.11
* 1. Calculates the product of the odd integers from 1 to 15.
*/
package Exercises;
public class ProductOddIntegers {
public static void main(String[] args) {
// initialization phase
int count;
int product = 1;
// loop from 1 to 15
for (count = 1; count <= 15; count += 2) {
// calculate the product
product = count * product;
} // [...]
Posted by: Chyne on: October 10, 2008
/* Exercise 5.10
* 1. Finds the smallest of several integers.
* 2. First value read specifies the number of values to input from the user.
*/
package Exercises;
import java.util.Scanner;
public class SmallestOfIntegers {
public static void main(String[] args) {
// initialization phase
int counter = 1;
int count = 1;
int num;
int num1;
int smallest = 0;
// create Scanner to obtain input from [...]