fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int x[30],min,max,y,sum=0;
  6. float avarage;
  7. for(y=0;y<30;y++)
  8. {
  9. printf("Enter the grade\n");
  10. scanf("%d", &x[y]);
  11. }
  12. max=x[0];
  13. min=x[0];
  14. for(y-0; y<30; y++)
  15. {
  16. if(x[y]>max)
  17. max=x[y];
  18.  
  19. if(x[y]<min)
  20. max=x[y];
  21.  
  22. sum=sum+x[y];
  23. }
  24. avarage=sum/30;
  25. printf("max is %d\n",max);
  26. printf("min is %d\n",min);
  27. printf("avarage is %f\n", avarage);
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
Enter the grade
max is -1
min is -1
avarage is 0.000000