#t4. 计算整数和与平均值
计算整数和与平均值
Integer Sum and Average
Problem Description
Write a program that computes the sum and the average of integers. The problem guarantees that both the input and the output fit within the integer range.
Input Format
The input gives integers on one line, separated by spaces.
Output Format
Output on one line the sum and the average in the format Sum=sum;Average=average, where the average is kept to exactly one decimal place.
Sample Input
1 2 3 4
Sample Output
Sum=10;Average=2.5
Constraints
The four input integers are all within the representable range of common programming languages (e.g. the int type in C/C++, the int type in Python).
Hint
- The average is a decimal — does dividing by
4give the same result as dividing by4.0? Think about integer division. - Every character of the output
Sum=10;Average=2.5must be printed exactly as shown, and only the average is kept to decimal place. (The separator is a half-width semicolon, exactly as in the sample.) - Check against the sample:
1 2 3 4→Sum=10;Average=2.5.
相关
在以下作业中: