#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,b=0;
clrscr();
printf("\nEnter any number :- ");
scanf("%d",&n);
for(i=2;i<n;i++)
{
if(n%i==0)
{
b=1;
break;
}
}
if(b==0)
{
printf("\nThe given number is a prime number ");
}
else
{
printf("\nThe given number is non-prime number ");
}
getch();
}
Output :-
Back to 'C Language Programs'
No comments:
Post a Comment