Advertisement
Rehan_Rahman26

array related problem 4

Oct 6th, 2021
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6.     int c=0,n;
  7.     cin >> n;
  8.     int ar[n];
  9.     for(int i=0; i<n; i++)
  10.     {
  11.         cin >> ar[i];
  12.     }
  13.     int key;
  14.     cin >> key;
  15.     for(int i=0; i<n; i++)
  16.     {
  17.         if(ar[i]==key)
  18.             c++;
  19.     }
  20.     printf("%d is found %d times in your list\n",key,c);
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement