Search C Program

Loading...

Star Pattern - 6

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

#include <stdio.h>

int main()
{
    int i, j, k;
    for(i=5;i>=1;i--)
    {
        for(j=5;j>i;j--)
        {
                printf(" ");
        }
        for(k=1;k<(i*2);k++)
        {
                printf("*");
        }
        printf("\n");
    }

    return 0;
}
Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C

5 comments:



  1. Int main()
    {
    Int i,j,k;
    For(i=1;i<12;i=i+2)
    {
    For(j=i;j<12;j=j+2)
    {
    Printf("*");
    }
    Printf("\n");
    For(k=i;k>0;k=k-2)
    {
    Printf(" ");
    }
    }
    }


































    ReplyDelete
  2. Check out this code for input of any number of rows:

    #include
    void main()
    {
    int i,j,k,n;
    printf("Enter the number of rows :\n");
    scanf("%d",&n);
    for(i=n;i>=1;i--)
    {
    for(k=n;k>i;k--)
    {
    printf(" ");
    }
    for(j=i*2-1;j>=1;j--)
    {
    printf("*");
    }
    printf("\n");
    }
    }

    ReplyDelete
  3. #include
    void main()
    {
    int i,j,n,k;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
    for(j=0;j<=(n-1)*2-i;j++){
    if(i<=j)
    {
    printf("*");
    }
    else
    printf(" ");
    }
    printf("\n");
    }
    }

    ReplyDelete
  4. #include
    void main()
    {
    int i,j,n,k,l=0;
    printf("\nEnter no of lines you want to print\n");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
    for(k=1;k<i;k++)
    printf(" ");
    for(j=1;j<=n*2-i-l;j++)
    {
    printf("*");
    }++l;
    printf("\n");
    }
    }

    ReplyDelete
  5. void main()
    {
    int i,j;
    for(i=1;i<=5;i++)
    {
    for (j=1;j<=6-i;j++)
    {
    printf("*");
    }
    printf("\n");
    }
    getch();
    }

    ReplyDelete