Saturday, 28 November 2015

Write a C Program To print pattern ABCDE descending order

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

No comments:

Post a Comment