/*PROGRAM FOR PRIME NO.*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,flag=0,n;
clrscr();
printf("Enter the no.::");
scanf("%d",&n);
for (i=2;i<=n/2;i++)
{
if(n%i==0)
{
printf("Not prime");
}
flag==1;
break;
}
if(flag==0)
{
printf("Prime");
}
getch();
}
/* ***********************OUTPUT***************************
Enter the no.::17
Prime*/
No comments:
Post a Comment