star pattern using for loop (#20222)

## Example for printing star pattern for pyramid 
```c

#include<stdio.h>
int
main ()
{
  int i, j;
  for (i = 1; i <= 5; i++)
    {

      for (j = i; j < 5; j++)
	{
	  printf (" ");
	}


      for (j = 1; j <= (2 * i - 1); j++)
	{
	  printf ("*");
	}


      printf ("\n");
    }

  return 0;
}
```
## Output:
```shell 
     *
    ***
   *****
  *******
 ********* 

``
pull/31421/head
Siddharth Shrivastav 2018-10-29 03:36:09 +05:30 committed by Christopher McCormack
parent 4dd798de05
commit c8aa2a4e9e
1 changed files with 42 additions and 0 deletions

View File

@ -42,4 +42,46 @@ int main () {
> Item on index 2 is 3 > Item on index 2 is 3
> Item on index 3 is 4 > Item on index 3 is 4
``` ```
## Example for printing star pattern for pyramid
```c
#include<stdio.h>
int
main ()
{
int i, j;
for (i = 1; i <= 5; i++)
{
for (j = i; j < 5; j++)
{
printf (" ");
}
for (j = 1; j <= (2 * i - 1); j++)
{
printf ("*");
}
printf ("\n");
}
return 0;
}
```
## Output:
```shell
*
***
*****
*******
*********
``