Output a sequence of integer numbers equal to the number specified number

Description questions
The output sequence numbers with the same specified number of an integer number.
Input Format
Input comprises three lines: a first behavior N, represents the length of the sequence of integers (N <= 100); N integers second line, separated by a space between integer; third row contains an integer, m is an integer specified.
Output Format
N is the number of outputs equal to the number with the number m.
Sample input
3
2 3 2
2
Sample Output
2
#include <stdio.h>
int main()
{
    int n,m,a[105],i,k;
    while(scanf("%d",&n)!=EOF){
        k=0;
        for(i=0;i<n;i++){
            scanf("%d",a+i);
        }
        scanf("%d",&m);
        for(i=0;i<n;i++){
            if(a[i]==m){
                k++;
            }
        }
        printf("%d\n",k);
    }
    return 0;
}

Published 32 original articles · won praise 9 · views 70000 +

Guess you like

Origin blog.csdn.net/yi__cao/article/details/78514973