Saturday, 28 November 2015

Write a C Program to print Floyds Triangle patten

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

No comments:

Post a Comment