كود:
// Write c++ program to read anumber and determines if it is a primary number?
#include <iostream.h>
int main ()
{
int num,x,y,z='T';
cout<<"Enter anumber :\t";
cin>>num;
if (num<=1)
cout<<"\n\t"<<num<<"\t*The Primary Number > 1* !!!!!!!\n\n\n\n";
else
{
x=num/2;
for(y=2 ; y<=x ; y++)
{
if(num%y==0)
{
z='F';
break;
} //end of if2
} //end of for
if(z=='F')
cout<<"\n\t"<<num<<"\t*Is Not Primary Number*\n\n\n\n";
if(z=='T')
cout<<"\n\t"<<num<<" \t*Is Primary Number*\n\n\n\n";
} //end of else
return 0;
} //end of main