k.jahangir kumar
javaprograms
1 Answer(s)      3 years and 10 months ago
Posted in : Java Beginners

write program

s=1x3x5x...........x17

Advertisement
View Answers

September 9, 2011 at 4:07 PM


import java.math.*;
class NumberExample 
{
    public static void main(String[] args) 
    {
        BigInteger p=new BigInteger("1");
        int m=0;
        for(int i=1; i<=17; i+=2){
        BigInteger n = BigInteger.valueOf(i);
        p=p.multiply(n);
        System.out.print(i+" ");
        }
        System.out.println();
        System.out.println(p);
    }
}