Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void max_d(int n, int &m1, int &m2)
- {
- m1=0;
- m2=0;
- int x=n;
- while(n)
- {
- if(n%10>m1)
- m1=n%10;
- n=n/10;
- }
- while(x)
- {
- if(x%10<m1 && x%10>m2)
- m2=x%10;
- x=x/10;
- }
- }
- int main()
- {
- int n=97332, m1, m2;
- max_d(n, m1, m2);
- cout<<m1<<" "<<m2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement