Solution to Write a program that takes a number n and outputs a point−down triangle of height … - Sikademy

Sept. 17, 2019

Archangel Macsika Sikademy Image

Archangel Macsika

Write a program that takes a number n and outputs a point−down triangle of height n and width 2n−1; the output for n = 6 would be: Enter a number: 6 *********** ********* ******* ***** *** *

Solution in Python Programming Language


height = int(input("Enter a number: "))
width = (2*height)-1
n = height
offset = 0
while (height > 0):
    print ' '*offset,"*"*width,"\n"
    height -= 1
    width = (2 * height) - 1
    offset = n - (height)

If you would like to see a different solution or an implementation in a different programming language Kindly let us know