Home / C / c program for pattern13

c program for pattern13

 C program for pattern making

       1
     21
  321
4321

Here is given c program for following pattern. In the above pattern we have two triangle one is empty space triangle together with the shown triangle. That’s why we have to put the loop for empty spaces together with the loop for the shown triangle.

ALSO CHECK : Alternate Java program for this pattern

#include<stdio.h>
#include<conio.h> 
void main()
{ 
int i,j,n; 
clrscr(); 
printf("Enter the number of lines for triangle"); 
scanf("%d",&n); 
for(i=1;i<=n;i++) //loop for number of lines in triangle 
{ 
for(j=1;j<=n-i;j++) // loop for spaces printf(" "); 
for(j=i;j>=1;j--) // loop for pattern to be print printf("%d",j); 
printf("\n"); // for next line
}
 getch(); 
}

OUTPUT:

pattern making in c

Check Also

How to Solve Linear Equation in One Variable In C Programming?

C Program to Solve any Linear Equation in One Variable Find complete C program to ...

Leave a Reply

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