Generation

code to explanationSun, 26 Feb 2023

bloques = int(input("Ingrese la cantidad de bloques: ")) altura = 0 while bloques >= altura + 1: altura += 1 bloques -= altura print("La altura de la pirámide construida es:", altura)

The user must enter the amount of building blocks and the program will calculate how many blocks you need to build a triangular pyramid.

Questions about programming?Chat with your personal AI assistant