#include "conio.h"
void main()
{
void prime(int);
int num;
clrscr();
printf("Enter a number : ");
scanf("%d",&num);
prime(num);
getch();
}
void prime(int x)
{
int i;
if(x==0||x==1)
{
printf("the no is neither prime nor composite");
}
else
{
for(i=2;i
{
if(x%i==0)
{
printf("\nThe number is not a prime number, it is a composite number");
break;
}
}
if(x==i)
{
printf("\nThe number is a prime number");
}
}
}
0 comments:
Post a Comment