Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int x, y, i = 2, min, max;
  6. cout << "So thu 1 = ";
  7. cin >> x;
  8. min = x; max = x;
  9. while (!cin.fail())
  10. {
  11. cout << "So thu " << i << " = ";
  12. cin >> y;
  13. if (y)
  14. {
  15. if (y > max) max = y;
  16. if (y < min) min = y;
  17. }
  18. x = y;
  19. i++;
  20. }
  21. cout << "So lon nhat = " << max;
  22. cout << "\nSo be nhat = " << min;
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement