i2tutorials

Program to print the given pattern using nested loop

Example Program:

 

To print the following pattern:-

*

* *

* * *

* * * *

 

#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=4;i++)
{
 for(j=1;j<=i;j++)
 {
 printf("*\t");
 }
printf("\n");
}
}

 

Output:

 

Program to print the given pattern using nested loop

 

Exit mobile version