Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- int main()
- {
- int n,v[5],max,min,i;
- cout<<"n=";cin>>n;
- for(i=1;i<=n;i++){cout<<"v["<<i<<"]=";
- cin>>v[i];}
- max=v[1];
- for(i=1;i<=n;i++)
- if(v[i]>max) max=v[i];
- cout<<"elem. max este "<<max;
- min=v[1];
- cout<<endl;
- for(i=1;i<=n;i++)
- if(v[i]<min) min=v[i];
- cout<<"elem. min este "<<min;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement