fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int n, i;
  5. long long product = 1;
  6.  
  7. printf("Enter the value of n: \n ");
  8. scanf("%d", &n);
  9.  
  10. for(i = 2; i <= n; i += 2) {
  11. product *= i;
  12. }
  13.  
  14. printf("Product of even numbers from 1 to %d = %lld\n", n, product);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5276KB
stdin
4
stdout
Enter the value of n: 
 Product of even numbers from 1 to 4 = 8