For many exercises of practice and understanding on cycles defined in programming, you will need to do exercises that although they have no real life implication are quite useful to understand the cycles in their entirety. One of the most common is to create the figure of a square, however without filling, only its edges. This can be achieved with a cycle within another cycle easily and using the instruction Escribir Sin Saltar
in order to print characters in a row on the same line:
Algoritmo BordeCuadrado
Definir numeroLados, contador Como Entero
Escribir "Enter the length of the sides:"
Leer numeroLados
Para a<-1 Hasta numeroLados Con Paso 1 Hacer
Para b<-1 Hasta numeroLados Con Paso 1 Hacer
Si a == 1 O a == numeroLados O b == 1 O b == numeroLados Entonces
Escribir Sin Saltar "* "
SiNo
Escribir Sin Saltar " "
FinSi
Fin Para
Escribir ""
Fin Para
FinAlgoritmo
Happy coding ❤️!