We would like to use for loop calculate product of odd integers from 1 to 15.
public class Main{ public static void main(String[] args){ int product = 1; //your code here System.out.printf("The product of the odd integers from 1 to 15 is: %d\n", product);/* w ww . j a v a 2s . c o m*/ } }
public class Main{ public static void main(String[] args){ int product = 1; for(int i=0; i<=15; i++){ if(i % 2 != 0) product *= i; } System.out.printf("The product of the odd integers from 1 to 15 is: %d\n", product); } }