Number Triangle Pattern – C Program

Number Triangle Pattern – C Program

write a c program for display the number triangle pattern shows like below.

1
1  2  3
1  2  3  4  5
1  2  3  4  5  6  7
1  2  3  4  5  6  7  8  9

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

void main()
{

 int i,j,k=1;
 for(i=1; i<=5; i++, k=k+2)
 {
  for(j=1; j<=k; j++)
    {
     printf(" %d",j);
    }
  printf("\n");
 }

 getch();

}

The output of Number Triangle patterns is :

1
1  2  3
1  2  3  4  5
1  2  3  4  5  6  7
1  2  3  4  5  6  7  8  9

 

Author: Meera Academy

Leave a Reply

Your email address will not be published. Required fields are marked *