Composite Number is a number which have more than two factors.
Example 1: 4 have three factors (1,2,4). Hence it is a Composite Number.
Example 2: 12 have six factors (1,2,3,4,6,12). Hence it is a Composite Number.
C
#include <stdio.h>
void main()
{
int n=0,flag=0;
printf("Enter a number: ");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
if(n%i==0)
{
flag++;
}
}
if(flag!=2)
{
printf("%d is a Composite Number",n);
}
else
{
printf("%d is not a Composite Number",n);
}
}C