Star Pattern program | pattern 2 : Triangle pattern program in C

Write a C program to print Triangle star pattern.

Triangle-star-pattern-program-in-c

Q: Write a C Program to print below Triangle star pattern.

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

Program: Triangle Star Pattern :

  1. #include<stdio.h>
  2. int main()
  3. {
  4.    int i,j,n;
  5.    printf(“Enter How many rows you want: “);
  6.    scanf(“%d”,&n);
  7.    for(i=1;i<=n;i++)
  8.    {
  9.       for(j=1;j<=i;j++)
  10.       {
  11.          printf(“* “);
  12.       }
  13.       printf(“\n);
  14.    }
  15.    return 0;
  16. }

Output :

Triangle-star-pattern-program-inc
Output of star pattern 

Similar Programs:

Also See:

 

Venkatesh

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

1 Response

  1. […] Pattern 2: Triangle Pattern Program […]

Leave a Reply