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