You are on page 1of 1

//find out the prime number with in a specific limit.

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int i,j,c,limit;
cout<<"give the limit:\n";
cin>>limit;
for(i=2;i<=limit;i++)
{
c=0;
for(j=i-1;j>1;j--)
{
if(i%j==0)c++;
}
if(c==0)
cout<<" "<<i;
}
return 0;
}

You might also like