The given number is a prime number or
composite number
#include<iostream.h>
#include<conio.h>
main()
{
int
n,found=0;
cout<<”Enter
the number”’;
cin>>n;
for(int
i=2;i<=n/2+1;i++)
{
If(n%i==0)
{
found=1;
break;
}
}
If(found==1)
cout<<”The
given number is a composite number”;
else
cout<<”the given number is a
prime number”;
getch();
}
0 comments:
Post a Comment