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
*********
*********
*********
***
***
***
***
***
***
Answers
Answer:
#include<iostream>
using namespace std;
int main(){
int i,n,j;
cin>>n;
for(i=1;i<=n;i++){
for(j=1;j<=3*n;j++){
cout<<"*";
}
cout<<endl;
}
for(i=1;i<=2*n;i++){
for(j=1;j<=n;j++){
cout<<" ";
}
for(int k=1;k<=n;k++){
cout<<"*";
}
cout<<endl;
}
return 0;
}
Explanation:
Language used: Python Programming
Program:
n=int(input())
#For the top horizontal line of T
for i in range(0,n):
print('*'*(3*n))
#for the bottom vertical line in T
for i in range(0, 2*n):
print('*'*n)
Sample output is attached below with n=3 as input.
Learn more:
Write a Python function sumsquare(l) that takes a nonempty list of integers and returns a list [odd,even], where odd is the sum of squares all the odd numbers in l and even is the sum of squares of all the even numbers in l.
brainly.in/question/15473120
Python program to find absolute difference between the odd and even numbers in the inputted number.
brainly.in/question/11611140