This problem requires programming, and four integer calculated average value. Title ensure that the input and the output are within the range of integers.
Input format:
input are four integer in a row, separated by a space therebetween.
Output formats:
in the format line "Sum = and; Average = Average" and sequentially outputs the average value, wherein an average value of decimal place.
Input Sample:
1 2 3 4
Output Sample:
the Sum = 10; Average = 2.5
#include <stdio.h>
int main()
{
int a,b,c,d;
int sum;
double average;
scanf("%d %d %d %d",&a,&b,&c,&d);
sum=a+b+c+d;
average=sum/4.0;
printf("Sum = %d; Average = %.1f",sum,average);
return 0;
}