Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6. int n, composition = 1;
  7. float count_ = 0;
  8. int check = scanf("%d", &n);
  9. if (n > 0 && n < 11 && check == 1)
  10. {
  11. int x[n];
  12.  
  13. for (int i = 1; i <= n; i++)
  14. {
  15. int check_2 = scanf("%d", &x[i]);
  16. if (check_2 != 1)
  17. { return 1; }
  18. if (x[i] > 0)
  19. {
  20. composition = composition * x[i];
  21. count_++;
  22. }
  23. }
  24. printf("%f", pow(composition, (1 / count_)));
  25.  
  26. return 0;
  27. }
  28. else
  29. { return 1; }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement