Computer Science, asked by patidarabhi000, 11 months ago

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

Answered by AbhijithPrakash
15
  • n=int(input("Enter the value of n : ")) # First we will take the value of n.
  • print("\n")
  • for i in range(0,n):
  •    for j in range(0,n*3):
  •        print("*", end="") ## This will print the "*" 3n times for making the  horizontal bar.(1)
  •    print()
  • for i in range(0,n*2):
  •    for j in range(0,n):
  •        print(" ", end="") # This will print the spaces to align the vertical line in the centre. (3)
  •    for j in range(0, n):
  •        print("*", end="") # This will print the star for making the verticle part of the Alphabet T. (2)
  •    print()
  • print()
Attachments:
Answered by poojan
9

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,end='')

   print('*'*n)

We have added an attachment of outputs for n=3, n=4, and n=5 too to make it more understanding about what's happening with the co de. Have a look.

Learn more:

1. Write a program to print the following pattern.

https://brainly.in/question/16895630

2. Write a program to display prime fibonacci numbers from 100 to 1000 in java

https://brainly.in/question/18378925

Attachments:
Similar questions