Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a,b,h=0,r,c, i;
- cout << "smaller ";
- cin >> a;
- cout << "bigger ";
- cin >> b;
- for (int n = a; n <= b; n++)
- {
- r = n;
- h = 0;
- while(r>0)
- {
- c = r % 10;
- r = r / 10;
- h = h*10+c;
- }
- if (n==h)
- {
- int prim = 0;
- for(i = 2; i <= n / 2; i++)
- {
- if(n % i == 0)
- {
- prim = 1;
- break;
- }
- }
- if (prim == 0)
- { cout << "#" << n << endl;}
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement