/************************************
*T'Nora Green
*Assignment 3, Exercise 5
*************************************/
import java.util.Scanner;
public class ProductEvenInts
{
public static void main(String[] args)
{
Scanner stdIn = new Scanner(System.in);
int i, num, product;
System.out.print("Enter a positive even number: ");
num = stdIn.nextInt();
product=1;
i=2;
do
{
product *= i;
i+=2;
}
while (i <= num);
System.out.println("Product = " + product);
}//end main
}//end class ProductEvenInts
No comments:
Post a Comment