A composite number is a positive integer that isn’t one of the prime numbers and has more than one factor. The first five composite numbers are known as “composites” for short. They are 4, 6, 8, 9, 10, and 12.

A for loop is a repetition control structure that allows us to create a loop that runs a set number of times. The loop allows us to do an arbitrary number of steps in a single line. A loop variable is used to regulate the loop in for loop.

A loop in C is made up of two parts: the loop body and the control statement. The control statement is a set of conditions that tells the loop’s body to keep running until the provided condition is false. The C loop’s goal is to repeat the same code several times. Using for loop we have successfully executed the prime number generation in c

```
//prime number generation in c
#include<stdio.h>
void main()
{
int i,j,n;
printf("Enter the number for prime number you want\n");
scanf("%d",&n);
printf("Prime numbers are\n");
for(i=2;i<=n;i++)
{
int c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
{
c++;
}
}
if(c==2)
{
printf("%d ",i);
}
}
}
```

Output of prime number generation in c:

Enter the number for prime number you want

45

Prime numbers are

2 3 5 7 11 13 17 19 23 29 31 37 41 43