fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int a,b,m1,m2;
  5. int main() {
  6. cin>>a>>b;
  7. if(a%10>m1)
  8. {
  9. m2=m1;
  10. m1=a%10;
  11. }
  12. else if(a%10>m2)
  13. m2=a%10;
  14. if(a/10>m1)
  15. {
  16. m2=m1;
  17. m1=a/10;
  18. }
  19. else if(a/10>m2)
  20. m2=a/10;
  21. if(b%10>m1)
  22. {
  23. m2=m1;
  24. m1=b%10;
  25. }
  26. else if(b%10>m2)
  27. m2=b%10;
  28. if(b/10>m1)
  29. {
  30. m2=m1;
  31. m1=b/10;
  32. }
  33. else if(b/10>m2)
  34. m2=b/10;
  35. cout<<"Numarul obtinut este: "<<10*m1+m2;
  36. return 0;
  37. }
Success #stdin #stdout 0.01s 5280KB
stdin
31 42
stdout
Numarul obtinut este: 43