Product of even integers in given range
C Program that calculates and prints the product of the even integers in given range.
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int i, low, high, prod=1;
printf("Enter lower limit: ");
scanf("%d", &low);
printf("Enter upper limit: ");
scanf("%d", &high);
for(i=low; i<=high; i++)
{
if(i % 2 == 0)
{
prod *= i;
}
}
printf("Product of Even numbers in the range (%d-%d) = %d", low, high, prod);
getch();
}
Output
Enter lower limit: 3
Enter upper limit: 10
Product of Even numbers in the range (3-10) = 1920