visualg ladder line break

2

I'm having trouble with the code to break the line. I need to create a ladder that looks like this:

    #
   ##
  ###
 ####
#####

If I put "#" ("#") it breaks the line, but the end result looks like this:

     #
    #
#
   #
#
#
  #
#
#
#
 #
#
#
#
#

Does anyone know which setting I should do? with the current code the result is getting like this:

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

Thank you so much !!

    
asked by anonymous 06.06.2016 / 01:17

1 answer

0

It looks like this:

Algoritmo "escada"
   Var
   p, x1, x, lin, col, degr: inteiro
   Inicio
   Escreva ("Quantidade de degraus: ")
   Leia (degr)
   degr:=degr + 1

   Para lin de degr ate 0 passo -1 faca
        Para col de 1 ate (degr - x) passo 1 faca
             escreva(" ")
        Fimpara
        Para col de 1 ate x passo 1 faca
             escreva("#")
        Fimpara
        x:=degr - lin
        escreval("")
   Fimpara
fimalgoritmo

Any questions just comment here that I answer. :)

    
06.06.2016 / 01:46