-------------------------------------------
// Program to print prime number between a range given by user //
#include<iostream.h>
#include<conio.h>
void main()
{
int i,j,x,y,c;
clrscr();
cout<<"\n\tPrime Number Finder";
cout<<"\nEnter Starting Number:";
cin>>x;
cout<<"\nEnter End Range Number:";
cin>>y;
for(i=x;i<=y;i++)
{ c=0;
for(j=2;j<i;j++)
{
if(i%j==0)
{c++;
}
}
if(c==0)
{
cout<<"\t"<<i;
}
}
getch();
}
No comments:
Post a Comment