Computer Science, asked by rajlaxmibhujbal99, 5 months ago

Program to print following triangle.
A
A B
A B C
A B C D

Answers

Answered by sarkarmalabika000
0

Answer:

// C++ code for triangular

// patterns of alphabets

#include <bits/stdc++.h>

using namespace std;

int main()

{

int i, j, n = 5;

for (i = 1; i <= n; i++)

{

for (j = i; j <= n; j++)

{

cout << (char)('A' - 1 + j) << " ";

}

cout << endl;

}

return 0;

}

// This code is contributed by

// shubhamsingh10

C

Java

Python3

C#

PHP

Output:

A B C D E

B C D E

C D E

D E

E

Answered by allysia
0

Answer:

The python code goes like:

\tt n = int(inpu t("Enter \ the \ number \ of \ row: \ "))\\\tt for \ i \ in \ range(0, \ n+1):\\\tt{\qquad for \ j \ in \ range(0, \ i):}\\\tt{\qquad \qquad print(chr (65+j), \ end="")}\\\tt{\qquad print()}

Similar questions