Display Number Triangle Pattern 1 to 5

By | June 20, 2019

“Display Number Triangle Pattern 1 to 5” is a C program to show the number triangle from 1 to 5 numbers as shown in the figure:

"Display Number Triangle Pattern 1 to 5" is a C program to show the number triangle from 1 to 5 numbers as shown in the figure:

“Display Number Triangle Pattern 1 to 5” is a C program to show the number triangle from 1 to 5 numbers as shown in the figure

The source code to print the number triangle pattern in c programming is as follows:

/*
Write a program to print number pattern
left triangle downward 1-5 in c programming 
language as shown below

   12345
   1234
   123
   12
   1

*/
#include<stdio.h>  
int main()   
{   
  int row, col;  
  for( row = 5; row >=1;row--)
  {
  	for(col=1; col<=row; col++)
	   printf("%d",col);   
  	printf("\n");
  }
  return 0;
}

This image will show the sample run and required output of number triangle program:

Number triangle pattern in c programming

Number triangle pattern in c programming

Loading

Leave a Reply

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