write a program to check for prime number in c language.
#include<stdio.h>
#include<conio.h>
Void main( )
{
int
I,n,j,count=0;
printf(“enter
your number:”);
scanf(“%d”,&n);
for(i=2;i<n;i++)
{
If(n%i==0)
{
Count++;
Break;
}
}
If(count==0&&n!=1)
{
Printf(“entered
no. is prime”);
}
Else
{
Printf(“enterd
no. is not prime “);
}
}
No comments
Post a Comment