1-6-01: The number of numbers that are the same as the specified number

Source: Internet
Author: User

Describe

Outputs the number of numbers in an integer sequence that are the same as the specified number.

Input
The
input contains three rows:
The first behavior n, which represents the length of the integer sequence (n <= 100);
Second behavior n integers, integers separated by a single space;
The third line contains an integer that is the specified integer m.
Output
The output is the number of numbers in the n number that are the
same as M.
Sample input
32 3 22
Sample output
2
#include <stdio.h>
int main ()
{
int n,temp[10001]={0},m,s=0,i;
scanf ("%d", &n);
for (i=1;i<=n;i++)
scanf ("%d", &temp[i]);
scanf ("%d", &m);
for (i=1;i<=n;i++)
{
if (temp[i]==m)
s++;
}
printf ("%d", s);
return 0;
}



1-6-01: The number of numbers that are the same as the specified number

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.