#include <iostream>
#include <conio.h>
#include <ctype.h>
#include <math.h>

using namespace std;
// return 1 if n is prime, 0
//otherwise
int isPrime(int p);
main()
{
for (int n=1; n< 50;n++)
if (isPrime(n)) cout<<n<<" ";getch();
cout<<endl;
}

int isPrime(int p)
{
float sqrtp=sqrt(p);
if (p<2) return 0; // 2 is
//the first prime
if (p==2) return 1;
if (p%2==0) return 0; //2 is
//14
//only the evenprime
for (int d=3; d<=sqrtp; d+=2)
if (p%d==0)return 0;
return 1;
}