Friday, September 2, 2016

Tags

PROGRAM TO PRINT PRIME NUMBERS UPTO 500;
#include<iostream>
using namespace std;
main()
{
int i,n,p=1;
cout<<"PRIME NO\n";
for(i=2;i<501;i++)
{
for(n=2;n<i/2;n++)
{
if(i%n==0)
{p=0;
break;
}
p=1;

}
if(p)
{cout<<"\t"<<i;
}

}
}