For Loop using Continue in C

In C programming using the continue keyword in For Loop control flow statement causes the loop to jump to the next iteration of the loop immediately.

Program For Loop using Continue Statement

Program

#include<stdio.h>
#include<conio.h>
void main()
{
for(int a = 1; a <= 10; a++) //loop looping from 1 to 10.
{
if(a == 5) //if 'a' value equal to 5 then
{
continue; //continue it mean skip 5.
}
printf("%d\n", a);
}
getch();
}
Output
1
2
3
4
6
7
8
9
10

Program Printing Triangle using For Loop

Program

#include<stdio.h>
#include<conio.h>
void main()
{
for(int a = 1; a <= 10; a++) //loop looping from 1 to 10.
{
for(int b = 1; b <= a; b++) //loop looping from 1 to 'a' value.
{
printf("*");
}
printf("\n"); //used for New Line.
}
getch();
}
Output
*
**
***
****
*****
******
*******
********
*********
**********

Random Program Using For Loop

Program

#include<stdio.h>
#include<conio.h>
#include<stdlib.h> //including Library for Random.
void main()
{
  printf("Ten random numbers in [1, 10]\n");
  for(int i = 1; i <= 10; i++) //loop looping from 1 to 10.
  {    //random number from 1 to 10 and assigning to 'n'.
   int n = rand() % 10 + 1;
    printf("%d\n", n); //and printing.
    }
    getch();
}
Output
Ten random numbers in [1, 10]
7
1
3
1
7
8
6
6
9
7

Random Program Using For Loop Another Method
Program

#include<stdio.h>
#include<conio.h>
#include<stdlib.h> //including library for Random.
void main()
{
  printf("Ten random numbers in [1, 10]\n");
  for(int i = 1; i <= 10; i++) //loop looping from 1 to 10.
  {    //random Number from 1 to 10 and assigning to 'n'.
   int num = random(10); //Random from 0 to 10 and assigning
      printf("%d\n", num); //to 'num' and printing.
    }
    getch();
}
Output
Ten random numbers in [1, 10]
6
8
0
6
4
8
2
6
1
6