csansoon

P1.05 X89070 Sum of the minimum and the maximum of three i

Sep 19th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main () {
  5.     int a,b,c,x,y;
  6.     cin >> a >> b >> c;
  7.    
  8.    
  9.     if (a<b) {
  10.         if (a<c) {
  11.             x=a;
  12.         }
  13.         else {
  14.             x=c;
  15.         }
  16.     }
  17.     else {
  18.         if (b<c) {
  19.             x=b;
  20.         }
  21.         else {
  22.             x=c;
  23.         }
  24.     }
  25.    
  26.    
  27.     if (a>b) {
  28.         if (a>c) {
  29.             y=a;
  30.         }
  31.         else {
  32.             y=c;
  33.         }
  34.     }
  35.     else {
  36.         if (b>c) {
  37.             y=b;
  38.         }
  39.         else {
  40.             y=c;
  41.         }
  42.     }
  43.     cout << (x+y) << endl;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment