Advertisement
ZhilinskiyG

Меньшее из 4 чисел

Jun 10th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4. void min(int a, int b, int c, int d) {
  5.     if (a<b && a<c && a<d) {
  6.         cout << a;
  7.     }else{
  8.     if (b<a && b<c && b<d) {
  9.         cout <<b;
  10.     }
  11.     else {
  12.         if (c<b && c<a && c<d) {
  13.             cout <<c;
  14.         }
  15.         else {
  16.             if (d<b && d<c && d<a) {
  17.                 cout <<d;
  18.                 }
  19.             }
  20.         }
  21.     }
  22. }
  23. int main()
  24. {
  25.     int a;
  26.     cin >> a;
  27.     int b;
  28.     cin >> b;
  29.     int c;
  30.     cin >> c;
  31.     int d;
  32.     cin >> d;
  33.     cout << "the smallest number is ";
  34.     min(a, b, c, d);
  35.     cout << endl;
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement