2
I’m having trouble with the code to break the line. I need to create a ladder that looks like below:
#
##
###
####
#####
If I write ("#") it breaks the line, but the end result is like this:
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
Does anyone know what adjustment I should make ? with the current code the result is getting that way:
Quantidade de degraus: 5
# ## ### #### #####
Algoritmo "escada"
Var
p, x1, x, lin, col, degr: inteiro
Inicio
Escreva ("Quantidade de degraus: ")
Leia (degr)
x:=degr
x1:=1
Para lin de 1 ate degr passo 1 faca
Para col de 1 ate x passo 1 faca
escreva(" ")
Fimpara
x:=x-1
Para p de 1 ate x1 passo 1 faca
escreva("#")
Fimpara
x1:=x1+1
escreva( )
Fimpara
fimalgoritmo
thanks in advance !!
I didn’t understand the variable x ai. I’m new in Programming Logic.
– Recepção Internamento