Advertisement
Gireada

Azi Info

Feb 5th, 2013
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<conio.h>
  3. int main()
  4. {int v[100],i,min,max;
  5. unsigned n,par;
  6. cout<<"n=";cin>>n;
  7. min=0;
  8. for(i=0;i<n;i++)
  9. {
  10. cout<<"v[" << i << "]=";
  11. cin>> v[i];
  12. }
  13. min=v[0];
  14. for(i=1;i<n;i++)
  15. if(v[i]<min)
  16. min=v[i];
  17.  
  18. max=0;
  19.  
  20. for(i=0;i<n;i++)
  21. if(v[i]>max)
  22. max=v[i];
  23.  
  24. par=0;
  25. for(i=0;i<n;i++)
  26. if(v[i]%2==0)
  27. par++;
  28.  
  29. cout<<"Cel mai mic element din vectorul V este:"<<min;
  30. cout<<endl<<"Cel mai mare element din vectorul V este:"<max;
  31. cout<<endl<<"Cate elemente pare are V:"<par;
  32. getch();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement