Hello Devs,

In this tutorial, we are going to learn C program for** finding prime numbers.**

Here is a well-commented example you can understand and analyze.

```
void main()
{
int n,i,sam=0;
printf("Enter a no:");
scanf("%d",&n);
for(i=2;i<=n/2;i++)
{
if(n%i==0)
sam=1;
}
if(sam==1)
printf("\n%d is not a prime no.",n);
else
printf("\n%d is a prime no.",n);
}
```

I hope this example helps you.