Inventor Pradhap

ஆதியும் அந்தமும் என் தமிழே🙏

Post Page Advertisement [Top]

How to Write a program for Prime number in C

How to Write a program for Prime number in C


Prime number in C
Prime number in C


 


#include<stdio.h>
int main()
{
	int n,i,state = 0;
	printf("\nEnter the number n	:");
	scanf("%d",&n);
	for(i=2;i<n;i++)
	{
		if(n%i !=0)
			continue;
		else
		{
			state = 1;
			printf("\nEntered number is not a prime");
			break;
		}
		
	}
	if (state ==0)
	{
		printf("\nEntered Number is Prime");
	}
	return 0;
}

No comments:

Post a Comment

Bottom Ad [Post Page]