A program to print the following pyramid.

A
AB
ABC
ABCD
ABCDE
ABCDEF



void Print()
{
int i, j;
for(i = 0; i<6; i++)
{
for(j = 0; j<= i; j++)
{
printf("%c",j+'A');
}
printf("\n");
}
}

int main()
{
Print();
return 0;
}

4 comments:

  1. program in c++ to print output in pyramid
    *
    * *
    * * *
    * * * *
    * * * * *

    ReplyDelete
  2. what will be a prog. to construct *
    ***
    *****
    ***
    *

    ReplyDelete
  3. thanks for help with this program but please explain ->printf("%c",j+'A');

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete