#include <stdio.h>
#include<conio.h>
void composite(int x);
void main()
{
int a;
printf("how much composite number you want to generate = ");
scanf("%d",&a);
composite(a);
getche();
}
void composite(int x)
{
int counter=0,number=0,i=1,j;
while(number<x)
{
counter=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
counter++;
}
if(counter>2)
{
printf("%d ",i);
number++;
}
i++;
}
}
No comments:
Post a Comment