prime or composite in c using function
#include<stdio.h>
int prime_composite(int num);
void main()
{
int n,ret;
printf ("Enter a number: ");
scanf ("%d",&n);
ret = prime_composite(n);
if(ret == 2 )
printf("\nThe number is Prime\n");
else
printf("\nThe number is Composite\n");
}
int prime_composite(int num)
{
int i, c=0;
for (i=1;i<=num;i++)
{
if(num%i==0)
c=c+1;
}
return c;
}