-->
Showing posts with label C program to print the given star pattern * * * * *. Show all posts
Showing posts with label C program to print the given star pattern * * * * *. Show all posts

C program to print the given star pattern * * * * *

/* C program to print the given star pattern
  * * * * *

            * * * * *

                       * * * * *

                                * * * * *
                                           * * * * *
                                * * * * *

                        * * * * *

            * * * * *
    * * * * *
 */
#include<conio.h>
#include <stdio.h>

void main()
{
    int i,j,k,m;
for(i=5;i>=1;i--)      //for number of rows. there are five rows so loop moves fives times
  {
    for(k=i;k<=7;k++)
      {
      printf(" ");   // this part is for space. every time , on display, it increases space.
      }
    for(j=1;j<=5;j++) //it displays star five times.It displays in columns
      {
        printf("* ");
      }
    printf("\n");
    }
    for(i=1;i<=4;i++)      //for number of rows. there are four rows so loop moves four times
    {
       
        for(k=i;k<=6;k++)
            {
            printf(" ");   // this part is for space. every time , on display, it decreases space.
            }
        for(j=1;j<=5;j++) //it displays star five times.It displays in columns
            {
            printf("* ");
            }m--;
        printf("\n");
    }
getch();
}