You can search on google as
https://www.google.co.in/?gfe_rd=cr&ei=Zl3PU6ySOarV8gfjooGACQ#q=example+nested+for+loop+in+c[
^]
Following is the examples
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,lines;
char ch = '*';
clrscr();
printf("Enter number of lines : ");
scanf("%d",&lines);
for(i=0;i <=lines;i++)
{
printf("n");
for (j=0;j < i;j++)
printf("%c",ch);
}
getch();
}
</conio.h></stdio.h>
the output is
*
* *
* * *
* * * *
* * * * *
* * * * * *
#include <stdio.h>
int main()
{
int row, c, n, temp;
printf("Enter the number of rows in pyramid of stars you wish to see ");
scanf("%d",&n);
temp = n;
for ( row = 1 ; row <= n ; row++ )
{
for ( c = 1 ; c < temp ; c++ )
printf(" ");
temp--;
for ( c = 1 ; c <= 2*row - 1 ; c++ )
printf("*");
printf("\n");
}
return 0;
}
</stdio.h>
Output
*
***
*****
*******
*********