F. Average
Problem link
https://algo.codemarshal.org/contests/diu-122-fl16-termwork/problems/F
Score: 1
CPU: 1s
Memory: 512MB
CPU: 1s
Memory: 512MB
You will be given five integer numbers. Calculate the average of given numbers.
Input
There will be five integer numbers
a, b, c, d
and e
( 1 < a, b, c, d, e < 1000 )
in one line separated by single spaces.Output
Print the average with two digits after decimal point.
Sample
Input | Output |
---|---|
1 2 3 4 5 | 3.00 |
Solution
#include<stdio.h> int main() { int a,b,c,d,e; double avg; scanf("%d%d%d%d%d",&a,&b,&c,&d,&e); if(1<a,b,c,d,e<1000){ avg=(a+b+c+d+e); } printf("%.2lf\n",avg/5); return 0; }
No comments:
Post a Comment