marius7122

Untitled

Jul 4th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int v[100], n, i, a, b, c;
  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<<"a= "; cin>>a;
  17.  
  18.     cout<<"b= "; cin>>b;
  19.  
  20.     for(i=0; i<n; i++)
  21.     {
  22.         if(v[i] >= a && v[i] <= b)
  23.         {
  24.             cout<<v[i]<<' ';
  25.             c++;
  26.         }
  27.     }
  28.  
  29.     cout<<c<<endl;
  30.     return 0;
  31.  
  32. }
Add Comment
Please, Sign In to add comment