Read A Number From Keyboard And Check Whether The Enter Number Is Prime Or Not.
#include<stdio.h>
#include<conio.h>
void main()
{
int
i,flag=0,no;
clrscr();
printf("\n
enter number");
scanf("%d",&no);
for
(i=2;i<=no-2;i++)
{
if(no%i==0)
{
flag=1;
break;
}
}
if(flag==0)
printf("\n
prime number");
else
printf("\n
not prime number");
getch();
}
|
OutPut :-
No comments:
Post a Comment