source file name: primeno.C
void main()
{
int n,m=0;
int d,op=0;
clrscr();
printf("\n enter any no:");
scanf("%d",&n);
m=n/2;
d=2;
while(d<=m)
{
if(n%d==0)
{
printf("\n given no is not Prime no");
op=1;
break;
}
else
d++;
}
if(op==0)
printf("\n given no is Prime no ");
getch();
}
output:
1. enter any no: 11
given no is Prime no
2. enter any no: 20
given no is not Prime no
1 Comments
Learning from knowledgeable instructors can make a significant difference. Their ability to explain complex topics and provide real-world examples is invaluable.click here for more information.
ReplyDeletePost a Comment