donmike25

tut5(5)

Jul 22nd, 2013
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int array[10];
  5. int i;
  6. float average=0;
  7. int x=0;
  8. int sum=0;
  9. int c=0;
  10.  
  11. printf("Enter 10 integers:");
  12. for(i=0;i<10;i++)
  13. {
  14. scanf("%d",&array[i]);
  15. sum=sum+array[i];
  16. c++;
  17. average=(float)sum/c;
  18. }
  19. for(i=0;i<10;i++)
  20. {
  21. if(array[i]>average)
  22. x++;
  23. }
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. printf("%d are integer highr than average\n",x);
  31.  
  32. printf("average:%.2f \n",average);
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment