#include<iostream.h>
#include<process.h>
void main()
{
int num,i;
clrscr();
cout<<"Enter the number ";
cin>>num;
for(i=2;i<=num/2;++i)
if(num%i==0)
{
cout<<"Not a prime number ";
exit(0);
}
cout<<"It is prime number ";
getch();
}
#include<process.h>
void main()
{
int num,i;
clrscr();
cout<<"Enter the number ";
cin>>num;
for(i=2;i<=num/2;++i)
if(num%i==0)
{
cout<<"Not a prime number ";
exit(0);
}
cout<<"It is prime number ";
getch();
}
No comments:
Post a Comment