SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     int minim = 10;
  9.     int maxim = -1;
  10.     cin >> n;
  11.     while(n){
  12.         minim = min(minim,n%10);
  13.         maxim = max(maxim,n%10);
  14.         n/=10;
  15.     }
  16.     cout << minim + maxim;
  17.     return 0;
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top