Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- long long int n,p=1;
- int cifre_prime(long long int n)
- {
- int c;
- while(n)
- {
- c=n%10;
- if(c==0||c==1||c==4||c==6||c==8||c==9)
- return 0;
- n/=10;
- }
- return 1;
- }
- int main()
- {
- cin>>n;
- for(int i=1;i<=n;i++)
- p*=10;
- int nr=p-1;
- p/=10;
- for(long long int i=p;i<=nr;i++)
- if(cifre_prime(i))
- cout<<i<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement