/*PROGRAM TO CHECK WHETHER A GIVEN NUMBER IS PRIME OR NOT*/
#include<conio.h>
#include<iostream.h>
class prime_no
{
int n,i,f;
public:
void input();
void output();
};
void prime_no::input()
{
cout<<“Enter any number: “;
cin>>n;
}
void prime_no::output()
{
f=0;
for(i=2;i<=(n/2);i++)
{
if(n%i==0)
f=1;
}
if(f==0)
cout<<n<<” is a prime number”;
else
cout<<n<<” is not a prime number”;
}
void main()
{
prime_no p1;
clrscr();
p1.input();
p1.output();
getch();
}