#include<iostream>
#include<conio.h>
using namespace std;
int main()
{ int c,num,p;
p=1;
cout<<"Enter an integer"<<endl;
cin>>num;
for(c=2;c<=num/2;c++)
if(num%c==0)
{
p=0;
break;}
if(p==1)
cout<<num<<" is a prime number";
else
cout<<num<<" is a composite number";
getch()
}
No comments:
Post a Comment