Advertisement
themlgyo

ТиТП2

Mar 1st, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.55 KB | None | 0 0
  1. #include <cmath>
  2. #include <iostream>
  3. using std::cout;
  4. using std::cin;
  5. using std::endl;
  6. int main()
  7. {
  8.     int A, B, C, max, min;
  9.     cout << "Vvedite 1 chislo" << endl;
  10.     cin >> A;
  11.     cout << "Vvedite 2 chislo" << endl;
  12.     cin >> B;
  13.     cout << "Vvedite 3 chislo" << endl;
  14.     cin >> C;
  15.     if (A > B && A > C) {
  16.             max = A;
  17.         }
  18.     if (B > A && B > C) {
  19.         max = B;
  20.     }
  21.     if (C > A && C > B) {
  22.         max = C;
  23.     }
  24.     if (A < B && A < C) {
  25.         min = A;
  26.     }
  27.     if (B < A && B < C) {
  28.         min = B;
  29.     }
  30.     if (C < A && C < B) {
  31.         min = C;
  32.     }
  33.     cout << "MAX = "<< max << endl;
  34.     cout << "MIN = " << min << endl;
  35.     return 0;
  36. }
  37.  
  38. ###############################################
  39.  
  40. #include <cmath>
  41. #include <iostream>
  42. using std::cout;
  43. using std::cin;
  44. using std::endl;
  45. int main()
  46. {
  47.     int A, B, C, D, k;
  48.     cout << "Vvedite 1 chislo" << endl;
  49.     cin >> A;
  50.     cout << "Vvedite 2 chislo" << endl;
  51.     cin >> B;
  52.     cout << "Vvedite 3 chislo" << endl;
  53.     cin >> C;
  54.     cout << "Vvedite 4 chislo" << endl;
  55.     cin >> D;
  56.     cout << "NACHALNAYA POSLEDOVATELNOST : " << A << " " << B << " " << C << " " << D << endl;
  57.     if (A > B) {
  58.         int k = A;
  59.         A = B;
  60.         B = k;
  61.     }
  62.     if (A > C)  {
  63.         int k = C;
  64.         C = A;
  65.         A = k;
  66.     }
  67.     if (A > D) {
  68.         int k = D;
  69.         D = A;
  70.         A = k;
  71.     }
  72.     if (B > C) {
  73.         int k = C;
  74.         C = B;
  75.         B = k;
  76.     }
  77.     if (B > D) {
  78.         int k = D;
  79.         D = B;
  80.         B = k;
  81.     }
  82.     if (C > D) {
  83.         int k = D;
  84.         D = C;
  85.         C = k;
  86.     }
  87.     cout << "" << endl;
  88.     cout << "####################################" << endl;
  89.     cout << "" << endl;
  90.     cout << "KONECHNAYA POSLEDOVATEL'NOST' : " << A << " " << B << " " << C << " "<< D << endl;
  91.     return 0;
  92. }
  93.  
  94. ######################################
  95.  
  96. #include <cmath>
  97. #include <iostream>
  98. using std::cout;
  99. using std::cin;
  100. using std::endl;
  101. int main()
  102. {
  103.     int x;
  104.     cout << "Vvedite chislo" << endl;
  105.     cin >> x;
  106.     if (x >= 10 && x <= 99) {
  107.         if ((x%2)==0) {
  108.             cout << x << " - 2-ZNACHNOE CHETNOE CHISLO" << endl;
  109.         }
  110.         else
  111.             cout << x << " - 2-ZNACHNOE, NO NECHETNOE CHISLO" << endl;
  112.         }
  113.     else cout << "VVEDITE DRYGOE CHISLO" << endl;
  114.     return 0;
  115. }
  116.  
  117. #######################################
  118.  
  119. #include <cmath>
  120. #include <iostream>
  121. using std::cout;
  122. using std::cin;
  123. using std::endl;
  124. int main()
  125. {
  126.     cout << "VVEDITE 3-ZNACHNOE CHISLO = " << endl;
  127.     int N, x1, x2, x3{};
  128.     cin >> N;
  129.     x3 = N % 10;
  130.     x2 = N / 10 % 10;
  131.     x1 = N / 100;
  132.     int S;
  133.     S = x1 + x2 + x3;
  134.     if ((S % 2) == 0) {
  135.         cout << "S = " << S << " - syymma cifr chisla CHETNAYA" << endl;
  136.     }
  137.     else cout << "S = " << S << " - syymma cifr chisla NECHETNAYA" << endl;
  138.     return 0;
  139. }
  140.  
  141. ##########################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement