Pattern 29: C Program to print below triangle number pattern using loops

Spread the love

Write a C Program to print below number pattern on the console:

Enter how many rows you want : 4
 1
 2 3
 4 5 6
 7 8 9 10

Note: This program is one of the Series of Number pattern programs in C.

Program:

  1. /*
  2.         C program to print triangle number pattern using for 
  3.         Website : www.SillyCodes.com
  4. */
  5. #include<stdio.h>
  6. int main()
  7. {
  8.    int i,j,n;
  9.    int count=0;
  10.    printf(“Enter how many rows you want : “);
  11.    scanf(“%d”,&n);
  12.    for(i=1;i<=n;i++)
  13.    {
  14.       for(j=1;j<=i;j++)
  15.       {
  16.          count++;
  17.          printf(” %d”,count);
  18.       }
  19.       printf(n);
  20.    }
  21.    return 0;
  22. }
Output :

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply