1-5-09: Number of integers

Source: Internet
Author: User

Describes a given k (1<k<100) positive integer, where each number is a number greater than or equal to 1, less than or equal to 10. The Write program calculates the number of occurrences of 1,5 and 10 in a given K positive integer. The input input has two lines: The first line contains a positive integer k, the second row contains k positive integers, and each two positive integers are separated by a single space. The output output has three rows, the number of occurrences of the first Act 1, the number of occurrences of the second Act 5, and the number of occurrences of the third Act 10. Sample input

Sample output

121

Introduction to Source Computing 05-Mock Exam 1

#include <stdio.h>intMain () {intN,i,a; intx=0, y=0, z=0; scanf ("%d",&N);  for(i=1; i<=n;i++) {scanf ("%d",&a); if(a==1) x++; if(a==5) y++; if(a==Ten) Z++; } printf ("%d\n%d\n%d\n", x, Y, z); return 0;}

1-5-09: Number of integers

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.