161k views
10 votes
This is for C++: Using a nested for loop output the following pattern to the screen:

A
AB
ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
ABCDEFGH
ABCDEFGHI
ABCDEFGHIJ
ABCDEFGHIJK
ABCDEFGHIJKL
ABCDEFGHIJKLM
ABCDEFGHIJKLMN
ABCDEFGHIJKLMNO
ABCDEFGHIJKLMNOP
ABCDEFGHIJKLMNOPQ
ABCDEFGHIJKLMNOPQR
ABCDEFGHIJKLMNOPQRS
ABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTU
ABCDEFGHIJKLMNOPQRSTUV
ABCDEFGHIJKLMNOPQRSTUVW
ABCDEFGHIJKLMNOPQRSTUVWX
ABCDEFGHIJKLMNOPQRSTUVWXY
ABCDEFGHIJKLMNOPQRSTUVWXYZ

2 Answers

12 votes

Answer:

yes

Step-by-step explanation:

because i said so

User AkshayBandivadekar
by
4.5k points
10 votes

Answer:

Following are the code to the given question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

int r=26,x,y;//defining integer variable

char c;//defining a character variable

for(x= 1; y<= r; x++)//using for loop for count value

{

for(y= 1; y<= x; y++)//using for loop to convert value in triangle

{

c=(char)(y+64);//convert value into character

cout << c;//print character value

}

cout << "\\";//use print method for line break

}

return 0;

}

Output:

Please find the attachment file.

Step-by-step explanation:

In this code, three integer variable "x,y, and r", and one character variable "c" is declared, that is used in the nested for loop, in the first for loop it counts the character value and in the next for loop, it converts the value into a triangle and uses the char variable to print its character value.

This is for C++: Using a nested for loop output the following pattern to the screen-example-1
User Jordan Allan
by
5.0k points