Q:

Calculate Product of Even Numbers Between 1 To 50 Using Java

0

This Program is used to calculate Product of Even Numbers between 1 to 50 using Java

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

// Product of Even Numbers between 1 to 50 

class ssvevenprod 
{ 
public static void main(String args[]) 
{ 
double sum=1.0; 
System.out.println("\n\n\t\tProduct of Even Numbers between 1 to 50"); 
for(int i=1;i<=48;i++) 
{ 
if(i%2==0) 
sum = sum * (double)i; 
}
System.out.println("\n\n\t\t\t\tProduct = " + sum); 
} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now