How To Print "HAPPY" In A Triangle In C++?

Please tell me how to print this triangle in c++....?

  • A AB ABC ABCD ABCDE ABCDEF

  • Answer:

    One for loop controls the width, the other controls the height. That's all you need to know.

sakshamk... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Hi, The following will print an alphabet triangle: #include<stdio.h> #include<conio.h> void main() { int i,j; int n; clrscr(); printf("Enter the ASCII character\t"); scanf("%d",&n); for(i=65;i<=n;i++) { for(j=65;j<=i;j++) printf("%c",i); printf("\n"); } getch(); } Note though that the out put would look like this: A BB CCC DDDD EEEEE FFFFFF I'm sure you can modify the loop to print what you want :) Regards, TgTips

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.