daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest May 17th, 2018 97 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.     int n , a=10 , b=-1;
  7.     cin >> n;
  8.     do
  9.     {
  10.         if(n%10 > b)
  11.             b = n%10;
  12.         if(n%10 < a)
  13.             a = n%10;
  14.         n /= 10;
  15.     }
  16.     while(n);
  17.     cout << a+b;
  18.     return 0;
  19. }
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
 
Top