fork download
  1. #include<iostream>
  2. using namespace std;
  3. bool chk(int n)
  4. {
  5. int a,b,c,d;
  6. a = n/1000;
  7. n -= a*1000;
  8. b = n/100;
  9. n -= b*100;
  10. c = n/10;
  11. d = n %= 10;
  12. if(d>c&&c>b&&b>a)
  13. {
  14. if(a*b == c+d) return true;
  15. else return false;
  16. }
  17. else return false;
  18. }
  19.  
  20. int main()
  21. {
  22.  
  23. for(int i=1234;i<10000;i++)
  24. {
  25. if(chk(i)) cout<<i<<endl;
  26.  
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
3457
3569
3578