Advertisement
idsystems

CPP_Practica42 - Diferencia

Jan 30th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. // Program: dif.cc
  2. // Author:  Yoan Pinzon
  3. // Date:    Agosto 30, 2006
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.    int a, b, c;
  12.  
  13.    cout << "Diferencia" << endl;
  14.    cout << "==========" << endl;
  15.  
  16.    cout << "Ingresar 3 numeros= "; cin >> a >> b >> c;
  17.  
  18.    cout << "La diferencia del mayor menos el menor es ";
  19.  
  20.    if(a>=b && b>=c) cout << a - c;
  21.    else if(a>=c && c>=b) cout << a - b;
  22.    else if(b>=a && a>=c) cout << b - c;
  23.    else if(b>=c && c>=a) cout << b - a;
  24.    else if(c>=a && a>=b) cout << c - b;
  25.    else cout << c - a;
  26.  
  27.    cout << endl;
  28.  
  29.    return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement