Prime Number Logical Program in C

This Prime Number Logical Program in C Page explains how to write the code to check the given input number is the Prime number or not using C Language Syntax. This post is also providing how to write FlowChart for Prime Number program.


Prime Number: The Number which is having 2 factors

#include<stdio.h>
void main()
{
int n , i, count=0 ;
printf(“Enter an integer : “);
scanf(“%d”, &n);
for(i=1 ; i<=n ; i++)
{
if(n%i==0)
{
count++ ;
}
}
if(count==2)
printf(“Prime Number”);
else
printf(“Not a Prime Number”);
}


FlowChart:

Prime Number Program FlowChart

Prime Number Program FlowChart

Share this