fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. int a,b,c,d,product;
  6. float gm;
  7.  
  8.  
  9. scanf("%d,%d,%d,%d", &a,&b,&c,&d);
  10. printf("Enter four numbers : %d,%d,%d,%d\n", a,b,c,d);
  11.  
  12. product = a*b*c*d;
  13. printf("Product is : %d\n", product);
  14.  
  15. gm = pow(product, 0.25);
  16. printf("Geometric mean is : %f\n", gm);
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5320KB
stdin
-1,-1,1,1
stdout
Enter four numbers : -1,-1,1,1
Product is : 1
Geometric mean is : 1.000000