Write a program that reads in a number n and prints out the letter To using'*'characters. The horizontal line in the 'Y'all should have length 3n and width n, and the vertical line below it should have length 2n and width n. Thus, for n=3 your program should print as follows
Answers
Answered by
7
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