SelinD

ex109

Apr 16th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4. int main()
  5. {
  6. int n,p,ok,i,aux,rez;
  7. cin>>n>>p;
  8. for(i=0;i<=n;i++)
  9. {
  10. ok=1;
  11. aux=i;
  12. rez=i;
  13. while(aux)
  14. {
  15. c=aux%10;
  16. if(c>p) aux=0;
  17. aux=aux/10;
  18. }
  19. if(ok) cout<<rez<<" ";
  20. }
Advertisement
Add Comment
Please, Sign In to add comment