fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n,tiv,a,b,c;
  6. cin>>n;
  7. for (tiv=100; tiv<=999; tiv++ )
  8. {
  9. a=tiv/100;
  10. b=tiv/10-10*a;
  11. c=tiv-100*a-10*b;
  12. if(a+b+c==n)
  13. cout<<tiv<<" ";
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 15232KB
stdin
3
stdout
102 111 120 201 210 300