Search C Program

Star Pattern - 1

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

#include <stdio.h>

int main()
{
    int i, j;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {
            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

13 comments:

  1. this is wrong and it will crash ur program
    the code is:
    for(i=0;i=n-i;j--)
    {
    printf("*");
    }
    }

    ReplyDelete
  2. Hey thanks for the code, but can u just explain the logic or execution of the loops? pls! :)
    m confused!

    ReplyDelete

  3. #include

    int main()
    {
    int n;
    printf("How many rows");
    scanf("%d",&n);
    for(int i=0; i<n; ++i)
    {
    for(int j=0; j<n; ++j)
    {
    printf(" ");
    }
    for(int k=0; k<=i; ++k)
    {
    printf("* ");
    }
    for(int l=0; l<n; ++l)
    {
    printf("\n");
    }
    }
    }


    ReplyDelete
  4. int i, j;
    for(i=1;i<=5;i )
    {
    for(j=1;j<=i;j )
    {
    printf("*");
    }
    printf("\n");
    }

    ReplyDelete
  5. In need this programe using only 1 for loop

    ReplyDelete