Advertisement
Md_hosen_zisad

check input with aaray

Sep 11th, 2017
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {   int i,arr[5],value,count=0;
  4.     for(i=0;i<5;i++)
  5.     {
  6.         scanf("%d",&arr[i]);
  7.     }
  8.     scanf("%d",&value);
  9.     for(i=0;i<5;i++)
  10.     {
  11.         if(value==arr[i])
  12.         {
  13.             count++;
  14.             }
  15.     }
  16.     if(count!=0)
  17.     {
  18.         printf("%d",count);
  19.     }
  20.     else
  21.     {
  22.         printf("not found");
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement