Saturday, 28 November 2015

Write a C Program to print pattern12


1:  //5  
2:  //4 4  
3:  //3 3 3  
4:  //2 2 2 2  
5:  //1 1 1 1 1  
6:  #include<stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:    int i,j,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=row;j>=i;j--)  
17:       {  
18:         printf("%d ",i);  
19:       }  
20:       printf("\n");  
21:    }  
22:    getch();  
23:  }  

No comments:

Post a Comment