#include <iostream>
#include<conio.h>
using namespace std;
int prime(int a)
{
int count=0;
for(int i=2;i<a;i++)
{
if(a%i==0)
{
count++;
}
}
if(count==0)
{
cout<<a<<" ";
}
return a;
}
int main()
{
int a,b;
cout<<"Enter two numbers to find prime Number b/w it "<<endl;
cout<<"Enter first No : ";
cin>>a;
cout<<"Enter second No : ";
cin>>b;
cout<<"\nThe prime number b/w "<<a<<" and "<<b<<" are "<<endl<<endl;
for(int i=a+1;i<b;i++)
{
prime(i);
}
getch();
return 0;
}
No comments:
Post a Comment