Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4.  
  5. {setlocale(LC_ALL, "Russian");
  6. int n;
  7. int a[5];
  8. for (int i = 0; i < 5; i++)
  9. {
  10. cout << "Введите число ";
  11. cin >> a[i];
  12. }
  13. if (a[0] > a[1]){
  14. n = a[0], a[0] = a[1], a[1] = n;
  15. }
  16. if (a[1] > a[2]) {
  17. n = a[1], a[1] = a[2], a[2] = n;
  18. }
  19. if (a[2] > a[3]) {
  20. n = a[2], a[2] = a[3], a[3] = n;
  21. }
  22. if (a[3] > a[4]) {
  23. n = a[3], a[3] = a[4], a[4] = n;
  24. }
  25.  
  26. //for (int i = 0; i < 5; i++) {
  27. // cout << " " << a[i];
  28. //}
  29. if (a[0] > a[3]) {
  30. n = a[0], a[0] = a[3], a[3] = n;
  31. }
  32.  
  33. if (a[1] > a[2]) {
  34. n = a[1], a[1] = a[2], a[2] = n;
  35. }
  36. if (a[2] > a[3]) {
  37. n = a[2], a[2] = a[3], a[3] = n;
  38. }
  39.  
  40.  
  41.  
  42. for (int i = 0; i < 5; i++) {
  43. cout << " "<<a[i];
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement