Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


k.jahangir kumar
javaprograms
1 Answer(s)      3 years and 4 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);
    }
}


Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com