Answer to Question #323939 in C++ for Raja

Question #323939

Write a program that takes input of the number of rows and then prints the diamond for the given number of rows using loops


Sample diagram


A


BCD


EFGH


IJKLMN


OPQRS


UWX


Y



1
Expert's answer
2022-04-07T04:03:57-0400
#include <iostream>

using namespace std;

int main()
{
	int i = 0;
	for (char c = 'A'; c <= 'Y'; c++)
	{
		if(c!='T'&&c!='V')
			cout << c;
		if (i == 0)
			cout << endl<<endl;
		if(i==3)
			cout << endl<<endl;
		if (i == 7)
			cout << endl<<endl;
		if (i == 13)
			cout << endl << endl;
		if (i == 18)
			cout << endl << endl;
		if (i == 23)
			cout << endl << endl;
		i++;
	}
}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS