Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*input 5 numbers and calculate the average & how many of those are above average*/
- #include<stdio.h>
- int main(){
- int i,n,c,s=0,x[5];
- float avg;
- for(i=0;i<5;i++){
- scanf("%d",&x[i]);
- s=s+x[i];
- }
- avg=s/5.0;
- printf("avg is %0.3f\n",avg);
- c=0;
- for(i=0;i<5;i++){
- if(x[i]>avg){
- c++;
- }
- }
- printf("%d",c);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement