To find the average age

Source: Internet
Author: User

Total time limit:
1000ms
Memory Limit:
65536kB
Describe

There are several students in the class, giving the age of each student (whole number), the average age of all students in the class, and the retention of two decimal places.

Input
The
first line has an integer n (1<= n <= 100) that represents the number of students. The next n rows have 1 integers per row, indicating the age of each student, with a value of 15 to 25.
Output
the output row, which contains a floating-point number, is reserved to two digits after the decimal point for the required average age.
Sample input
21817
Sample output
17.50
Tips
to output floating-point numbers, double-precision digits after the decimal 2 digits, you can use the following form:

printf ("%.2f", num);
Source
2005~2006 Medical Department Calculation Introduction final exam
#include <stdio.h>intMain () {intn,a[101],u,s=0; DoubleAA; scanf ("%d",&N);  for(u=1; u<=n;u++) {scanf ("%d",&A[u]); S=s+A[u]; } AA=(Double) s/N; printf ("%.2LF", AA); return 0;}

To find the average age

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.