Reverse letter box size - VISUALG

Asked

Viewed 795 times

0

I’m having a problem with programming visualG algorithms. need to invert an array with values assigned to it.

// opcao 18
funcao menu_18():caractere
var
inicio
escreval (" A ORDEM INVERSA É: ")
para contador de 12 ate 0 faca
     escreva(" ", c[contador])
fimpara
escreval(" ")
fimfuncao

where the counter values go from 0 to 12, with characters assigned to them, but need to print the reverse of them.

example (" A B C ")

saída: (" C B A ")

what would be the best resolution to this problem?

  • Hi @Agenaro try to use step -1 in the loop that will go straight!

1 answer

1

escreval (" A ORDEM INVERSA É: ")
para contador de 12 ate 0 faca
     escreva(c[contador])
fimpara

This section is right, confirm that your vector is [0.. 12], see if you are correctly assigning the values to the vector, do not know if you are setting the values in the code itself or if you are reading from the keyboard, but anyway, it is likely that if you are having some problem is the time to assign the data in the vector.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.