Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // dragutinmajranovic
- #include <iostream>
- using namespace std;
- bool prost(int n)
- {
- for (int i=2; i<n; i++)
- if (n%i==0)
- return false;
- return true;
- }
- main()
- {
- int n, s = 0;
- cin >> n;
- for (int i=1; i<n; i++)
- if (prost(i)==true && prost(i+2)==true)
- { // cout << i << " " << i+2 << endl;
- s++; i = i + 2; }
- cout << s << endl;
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement