Saturday, 28 November 2015

Write a C Program to print Triangle pattern2

1:  //  *  
2:  //  **  
3:  // ***  
4:  // ****  
5:  //*****  
6:  #include<stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:   int i, j, k, row;  
11:   clrscr();  
12:   printf("Enter the number of rows you want:\n");  
13:   scanf("%d",&row);  
14:   for(i=row;i>=1;i--)  
15:   {  
16:   for(j=1;j<i;j++)  
17:   {  
18:    printf(" ");  
19:   }  
20:   for(k=row;k>=i;k--)  
21:   {  
22:    printf("*");  
23:   }  
24:   printf("\n");  
25:   }  
26:   getch();  
27:  }  

No comments:

Post a Comment