Advertisement
Tahamina_Taha

Average of four numbers

Aug 17th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. //Average of four numbers
  5. {
  6.     int a,b,c,d,sum;
  7.     float avg;
  8.     printf("Enter four numbers : \n");
  9.     scanf(" %d %d %d %d",&a,&b,&c,&d);
  10.     sum=a+b+c+d;
  11.     avg=(float)sum/4;
  12.     printf("sum=%d\n",sum);
  13.     printf("Average =%.2f",avg);
  14.  
  15.     return 0;
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement