0
877views
Write a program to display the following pattern
              1
          2   1    A
    3     2   1    A   B
4   3     2   1    A   B    C

Subject : Structured Programming Approach

Title : Control Structures

Marks : 10M

1 Answer
0
1views
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the number of lines:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
    for(j=1;j<=n-i;j++)
    {
        printf(" ");
    }
    for(j=i;j>=1;j--)
    {
        printf("%d",j);
    }
    for(j=1;j<=i-1;j++)
    {
        printf("%c",(j+'A'-1));
    }
    printf("\n");
}
}
Please log in to add an answer.