Advertisement
marius7122

Untitled

Jul 9th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int v[100], n, i, x;
  6.  
  7. int main()
  8. {
  9.     cout<<"n = "; cin>>n;
  10.  
  11.     for(i = 0; i < n; i++)
  12.     {
  13.         cout<<"v["<<i<<"]= "; cin>>v[i];
  14.     }
  15.  
  16.     cout<<"x= "; cin>>x;
  17.  
  18.     int gasit = 0;
  19.  
  20.     for(i = 0; i < n; i++)
  21.     {
  22.         if(x == v[i])
  23.             gasit = 1;
  24.     }
  25.  
  26.     if(gasit == 0)
  27.         cout<<" x nu se afla in sir "<<endl;
  28.  
  29.     else
  30.         cout<<" x se afla in sir "<<endl;
  31.  
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement