1-6-05: Age and disease

Source: Internet
Author: User

Describe

A hospital would like to check whether the availability of a disease is related to age, the previous diagnostic records need to be collated, according to 0-18, 19-35, 36-60, 61 (including 61) four age groups accounted for the proportion of the total number of people affected.

Input
Total 2 lines, first act the number of past patients N (0 < n <= 100), the second act of each patient's age at the time of illness.
Output
according to the output of 0-18, 19-35, 36-60, 61 (including 61) Four age groups, the proportion of the total number of people affected by the disease is as a percentage of the output, accurate to two digits after the decimal point. Each age group occupies a row, a total of four rows.
Sample input
101 11 21 31 41 51 61 71 81 91
Sample output
20.00%20.00%20.00%40.00%
1#include <stdio.h>2 intMain ()3 {4     inta[5]={0};5     intn,y;6scanf"%d",&n);7      for(intI=1; i<=n;i++)8     {9scanf"%d",&y);Ten         if(y<= -) {a[1]++;Continue;} One         if(y<= *) {a[2]++;Continue;} A         if(y<= -) {a[3]++;Continue;} -a[4]++; -     } theprintf"%.2f%%\n%.2f%%\n%.2f%%\n%.2f%%\n",(float) a[1]/n* -,(float) a[2]/n* -,(float) a[3]/n* -,(float) a[4]/n* -); -     return 0; -}

1-6-05: Age and disease

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.