Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- unsigned int pr(unsigned int x) {
- if(x < 2) {
- return 0;
- }
- for(unsigned int div = 2; div*div <= x; ++div) {
- if(x%div == 0) {
- return 0;
- }
- }
- return 1;
- }
- int main() {
- ifstream fin("date.in");
- unsigned int n;
- fin >> n;
- while(n >= 100) {
- n /= 10;
- if(pr(n)) {
- cout << n << " ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement