Determine Prime No.
      A prime no. is a no. which is divisible by itself and 1. So to find the prime no. we divide the number begining from 2 uptil square root of the number.
/*
	http://www.ProbCOMP.com
	
	A prime no. is a no. which is divisible by itself and 1. So to find the prime no. 
	We divide the number begining from 2 uptil square root of the number.
	We choose loop uptil square root of the number because after that repeatition occurs.

*/

void prime(int n)
{
	int flag=0;
	for(int i=2;i<=sqrt(n);i++)
	{
		if(n%i==0)
		{
			flag=1;
			break;
		}
	}
	
	if(flag==0)
	
		printf("%d is a prime number",n);
	else
		printf("%d is not a prime number",n);
}

									

Download Program
Did You Know ?
IP address is a numerical label that is assigned to devices participating in a computer network. Read More