Answer to Question #102794 in C++ for Johnimmanuvel

Question #102794
Write a program that reads in a number and prints out the letter T using '*' characters with each line in the T having width n. Further, the length of the horizontal bar should be 3n, and that of the vertical bar 2n. Thus for n=3 your program should print

*********
*********
*********
***
***
***
***
***
***
1
Expert's answer
2020-02-11T14:08:16-0500
#include<iostream>
using namespace std;


int main() 
{ 
    int n;
    cout<<"Enter size of T : ";
    cin>>n;
    for( int i=0;i<n;i++)
    {
    	for(int j=0; j<3*n;j++)
    		cout<<"*";
		cout<<endl;
	}
	for(int i=0;i<2*n;i++)
	{
		for(int j=0;j<n;j++)
			cout<<" ";
		for(int j=0; j<n;j++)
			cout<<"*";
		cout<<endl;
	}
    return 0; 
} 

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