Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n, max=-1, min=999999999,suma=0;
  8. cout << "n=";
  9. cin >> n;
  10. for(int i=1 ; i<=n; ++i)
  11. {
  12. suma=suma+i;
  13. int x;
  14. cin >> x;
  15. if (x>=max)
  16. max=x;
  17. if (x<=min)
  18. min=x;
  19.  
  20. }
  21. cout << "maximul este" << max << "\n" << "minimul este " << min << "\n" << "suma este" << suma;
  22.  
  23.  
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement