Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int anaPrime[] = {2,3,5,7,11,13,17,31,37,71,73,79,97,113,131,199,311,337,373,733,919,991};
- int main()
- {
- long long n,i,num;
- while(scanf("%lld",&n)&&n)
- {
- num = 1;
- while(num<=n)
- {
- num*=10;
- }
- bool dhukse = false;
- for(i=0;i<22;i++)
- {
- if(anaPrime[i]>n && anaPrime[i]<num)
- {
- dhukse = true;
- printf("%d\n",anaPrime[i]);
- break;
- }
- }
- if(!dhukse)
- {
- puts("0");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment