avatar
Saba Techatom
0

Codes

1

Answers

Code compilers

Top answers

0
c programming print pattern pyramid
May-09-2022
#include <stdio.h>   
int main()  
{  
    int height,space,i,j,k;  
    printf("Enter the height of the triangle: ");  
    scanf("%d",&height);  
    space=height;  
   for( i=1;i<=height;i++)  
   {  
       for( j=1;j<space-1;j++)  
       {  
           printf(" ");  
       }  
       for( k=1;k<=2*i-1;k++)  
       {  
         printf("*");  
       }  
       space--;  
     
      printf("\n");  
    }  
    return 0;  
}