Advertisement
a53

CifreGen2

a53
Feb 4th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. long long int n,p=1;
  5. int cifre_prime(long long int n)
  6. {
  7. int c;
  8. while(n)
  9. {
  10. c=n%10;
  11. if(c==0||c==1||c==4||c==6||c==8||c==9)
  12. return 0;
  13. n/=10;
  14. }
  15. return 1;
  16. }
  17. int main()
  18. {
  19. cin>>n;
  20. for(int i=1;i<=n;i++)
  21. p*=10;
  22. int nr=p-1;
  23. p/=10;
  24. for(long long int i=p;i<=nr;i++)
  25. if(cifre_prime(i))
  26. cout<<i<<'\n';
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement