Advertisement
inhuman_Arif

Ques 4

Oct 7th, 2021
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. typedef long long ll;
  5.  
  6. int main()
  7. {
  8.     #ifndef ONLINE_JUDGE
  9.         freopen("input.txt", "r", stdin);
  10.         freopen("output.txt", "w", stdout);
  11.     #endif
  12.  
  13.     int n;
  14.     cin >> n;
  15.     int arr[n];
  16.     for(int i=0;i<n;i++)
  17.         cin >> arr[i];
  18.     int search;
  19.     cin >> search;
  20.     int cnt=0;
  21.     for(int i=0;i<n;i++)
  22.         if(arr[i]==search)
  23.             cnt++;
  24.     printf("%d is found %d times in your list\n",search,cnt);
  25.    
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement