Martes, Nobyembre 29, 2011

Write a java program that calculate the product of the odd integers from 1 to 20

import java.io.*;
public class sample2 {


    public static void main(String[] args)throws IOException {
       BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

       int total=1;
       for(int x=3;x<=20;x+=2){
           total=total*x;
           
       }
        System.out.print("Product of odd integers is: "+total);
    }

}

1 komento:

  1. Ya!! Interesting and learning , more I want like this type of questions of numbers, thankyou to the administrator of this website, thanks a lot. Please Can you send me other programmings to my email [e-mail : agarwaljiparnam@gmail.com]. Again I like to thanks you a lot.

    TumugonBurahin