Advertisement
Aminpro

[ECP 1016]Tutorial 5 Question 5

Jul 15th, 2012
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. //https://www.facebook.com/AminproPastebin
  2.  
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7.     int x =0;
  8.     int matrix[10];
  9.     float avg=0;
  10.     int total=0;
  11.     int mostpos = 0;
  12.    
  13.  
  14.     printf("Enter 10 intergers: ");
  15.     while(x<10){
  16.     scanf("%d", &matrix[x]);
  17.     x ++;
  18.     }
  19.     x = 0;
  20.     while(x<10){
  21.     total = total + matrix[x];
  22.     x ++;
  23.     }
  24.     avg = total/10;
  25.     printf("Average : %.2f\n", avg);
  26.     x =0;
  27.     while(x<10){
  28.             total = matrix[x];
  29.             x ++;
  30.                 if(total > avg){
  31.                     mostpos ++;
  32.             }      
  33. printf("%d integer is larger than the average.\n", mostpos);
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement