source file name: Primeno3.CPP
#include<conio.h>
#include<iostream.h>
int main()
{
int n,d;
clrscr();
cout<<"\n enter any number: ";
cin>>n;
d=2;
while(d<n)
{
if(n%d==0)
{
cout<<"\n given no is not prime no: "<<n;
break;
}
else
d++;
}
if(n==d)
cout<<"\n given no is prime no: " <<n;
return 0;
}
output:
0 Comments
Post a Comment