void main()
{
clrscr();
int num,i,c;
cout<<"PROGRAM TO FIND THE PRIME NUMBER";
cout<<"\nENTER THE NUMBER : ";
cin>>num;
if(num==1)
{
cout<<"THE GIVEN NUMBER IS A PRIME NUMBER";
}
for(i=2;i<=num-1;i++)
{
if(num%i == 0)
{
cout<<"THE GIVEN NUMBER IS NOT A PRIME NUMBER";
break;
}
}
if(i==num)
{
cout<<"THE GIVEN NUMBER IS A PRIME NUMBER";
}
getch();
}
No comments:
Post a Comment