Kevin321888999

lab 4 part B

Apr 1st, 2022
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. double aver(double num1,double num4){
  4. return ((num1)/num4);
  5. }
  6. double addition(double num1,double num2){return num1+num2;}
  7. int main(void) {
  8. double X;
  9. double average;
  10. double trials;
  11. double i=0;
  12. double sum;
  13.  
  14. do{
  15. printf("\nEnter the test scores: ");
  16. scanf("%lg",&X);
  17. sum=addition(X,sum);
  18. i++;}
  19. while(X>=0);
  20. sum-=X;
  21. average=aver(sum,i-1);
  22. printf("Average is %lg",average);
  23. return 0;}
  24.  
Advertisement
Add Comment
Please, Sign In to add comment