Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a, b, max1=0, max2=0, min1=9, min2=9, c;
- cout<<"a="; cin>>a;
- cout<<"b="; cin>>b;
- while(a!=0)
- {
- c=a%10;
- if(c>max1)
- max1=c;
- if(c<min1)
- min1=c;
- a/=10;
- }
- while(b!=0)
- {
- c=b%10;
- if(c>max2)
- max2=c;
- if(c<min2)
- min2=c;
- b/=10;
- }
- if(min1>min2)
- cout<<min2<<min1<<" ";
- else
- cout<<min1<<min2<<" ";
- if(max1>max2)
- cout<<max1<<max2<<" ";
- else
- cout<<max2<<max1<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement