Skip to main content
Used new style "escribir" instruction instead of the old "Escribir" function
Source Link

PseudoD, 688 579579 521 bytes

utilizar mate.pseudo
utilizar entsal.pseudo
adquirir n
adquirir a
adquirir r
adquirir i
fijar n a llamar LeerPalabra finargs
si son iguales n y CERO
llamar EscribirLineaescribir {0} finargs
salir
fin
fijar a a llamar ValorAbsoluto n finargs
fijar i a CERO
si comparar Importar.Ent.Comparar n < CERO
fijar r a {~}
sino
fijar r a {-}
fin
mientras comparar Importar.Ent.Comparar i < a
llamar Escribirescribir r finargs
si son iguales r y {~}
fijar r a {-}
Importar.Ent.Sumar i UNO i
sino
fijar r a {~}
fin
finbucle
si son iguales r y {~}
llamar Escribirescribir {~} finargs
fin
llamar Escribirescribir {0} finargs

Explain:

Read a number from STDIN;
If the number is zero (0); Then:
    Writes 0 to STDOUT and exits;
End If;
If the number is less than zero (0); Then:
    Set the fill character to "~";
Else:
    Set the fill character to "-";
End If;
For i = 0; While i is less than abs(number); do:
    Write the fill character to STDOUT;
    If the fill character is "~":
        Set the fill character to "-"
        Increment i by one
    Else:
        Set the fill character to "~"
    End if;
End for;
If the fill character is "~"; Then:
    Write "~" to STDOUT;
End If;
Write "0" to STDOUT

PseudoD, 688 579 bytes

utilizar mate.pseudo
utilizar entsal.pseudo
adquirir n
adquirir a
adquirir r
adquirir i
fijar n a llamar LeerPalabra finargs
si son iguales n y CERO
llamar EscribirLinea {0} finargs
salir
fin
fijar a a llamar ValorAbsoluto n finargs
fijar i a CERO
si comparar Importar.Ent.Comparar n < CERO
fijar r a {~}
sino
fijar r a {-}
fin
mientras comparar Importar.Ent.Comparar i < a
llamar Escribir r finargs
si son iguales r y {~}
fijar r a {-}
Importar.Ent.Sumar i UNO i
sino
fijar r a {~}
fin
finbucle
si son iguales r y {~}
llamar Escribir {~} finargs
fin
llamar Escribir {0} finargs

Explain:

Read a number from STDIN;
If the number is zero (0); Then:
    Writes 0 to STDOUT and exits;
End If;
If the number is less than zero (0); Then:
    Set the fill character to "~";
Else:
    Set the fill character to "-";
End If;
For i = 0; While i is less than abs(number); do:
    Write the fill character to STDOUT;
    If the fill character is "~":
        Set the fill character to "-"
        Increment i by one
    Else:
        Set the fill character to "~"
    End if;
End for;
If the fill character is "~"; Then:
    Write "~" to STDOUT;
End If;
Write "0" to STDOUT

PseudoD, 688 579 521 bytes

utilizar mate.pseudo
utilizar entsal.pseudo
adquirir n
adquirir a
adquirir r
adquirir i
fijar n a llamar LeerPalabra finargs
si son iguales n y CERO
escribir {0}
salir
fin
fijar a a llamar ValorAbsoluto n finargs
fijar i a CERO
si comparar Importar.Ent.Comparar n < CERO
fijar r a {~}
sino
fijar r a {-}
fin
mientras comparar Importar.Ent.Comparar i < a
escribir r finargs
si son iguales r y {~}
fijar r a {-}
Importar.Ent.Sumar i UNO i
sino
fijar r a {~}
fin
finbucle
si son iguales r y {~}
escribir {~}
fin
escribir {0}

Explain:

Read a number from STDIN;
If the number is zero (0); Then:
    Writes 0 to STDOUT and exits;
End If;
If the number is less than zero (0); Then:
    Set the fill character to "~";
Else:
    Set the fill character to "-";
End If;
For i = 0; While i is less than abs(number); do:
    Write the fill character to STDOUT;
    If the fill character is "~":
        Set the fill character to "-"
        Increment i by one
    Else:
        Set the fill character to "~"
    End if;
End for;
If the fill character is "~"; Then:
    Write "~" to STDOUT;
End If;
Write "0" to STDOUT
Reduced variable's names in code
Source Link

PseudoD, 688688 579 bytes

utilizar mate.pseudo
utilizar entsal.pseudo
adquirir numeron
adquirir absa
adquirir rellenor
adquirir indicei
fijar numeron a llamar LeerPalabra finargs
si son iguales numeron y CERO
llamar EscribirLinea {0} finargs
salir
fin
fijar absa a llamar ValorAbsoluto numeron finargs
fijar indicei a CERO
si comparar Importar.Ent.Comparar numeron < CERO
fijar rellenor a {~}
sino
fijar rellenor a {-}
fin
mientras comparar Importar.Ent.Comparar indicei < absa
llamar Escribir rellenor finargs
si son iguales rellenor y {~}
fijar rellenor a {-}
Importar.Ent.Sumar indicei UNO indicei
sino
fijar rellenor a {~}
fin
finbucle
si son iguales rellenor y {~}
llamar Escribir {~} finargs
fin
llamar EscribirLineaEscribir {0} finargs

Explain:

Read a number from STDIN;
If the number is zero (0); Then:
    Writes 0 to STDOUT and exits;
End If;
If the number is less than zero (0); Then:
    Set the fill character to "~";
Else:
    Set the fill character to "-";
End If;
For i = 0; While i is less than abs(number); do:
    Write the fill character to STDOUT;
    If the fill character is "~":
        Set the fill character to "-"
        Increment i by one
    Else:
        Set the fill character to "~"
    End if;
End for;
If the fill character is "~"; Then:
    Write "~" to STDOUT;
End If;
Write "0" to STDOUT

PseudoD, 688 bytes

utilizar mate.pseudo
utilizar entsal.pseudo
adquirir numero
adquirir abs
adquirir relleno
adquirir indice
fijar numero a llamar LeerPalabra finargs
si son iguales numero y CERO
llamar EscribirLinea {0} finargs
salir
fin
fijar abs a llamar ValorAbsoluto numero finargs
fijar indice a CERO
si comparar Importar.Ent.Comparar numero < CERO
fijar relleno a {~}
sino
fijar relleno a {-}
fin
mientras comparar Importar.Ent.Comparar indice < abs
llamar Escribir relleno finargs
si son iguales relleno y {~}
fijar relleno a {-}
Importar.Ent.Sumar indice UNO indice
sino
fijar relleno a {~}
fin
finbucle
si son iguales relleno y {~}
llamar Escribir {~} finargs
fin
llamar EscribirLinea {0} finargs

Explain:

Read a number from STDIN;
If the number is zero (0); Then:
    Writes 0 to STDOUT and exits;
End If;
If the number is less than zero (0); Then:
    Set the fill character to "~";
Else:
    Set the fill character to "-";
End If;
For i = 0; While i is less than abs(number); do:
    Write the fill character to STDOUT;
    If the fill character is "~":
        Set the fill character to "-"
        Increment i by one
    Else:
        Set the fill character to "~"
    End if;
End for;
If the fill character is "~"; Then:
    Write "~" to STDOUT;
End If;
Write "0" to STDOUT

PseudoD, 688 579 bytes

utilizar mate.pseudo
utilizar entsal.pseudo
adquirir n
adquirir a
adquirir r
adquirir i
fijar n a llamar LeerPalabra finargs
si son iguales n y CERO
llamar EscribirLinea {0} finargs
salir
fin
fijar a a llamar ValorAbsoluto n finargs
fijar i a CERO
si comparar Importar.Ent.Comparar n < CERO
fijar r a {~}
sino
fijar r a {-}
fin
mientras comparar Importar.Ent.Comparar i < a
llamar Escribir r finargs
si son iguales r y {~}
fijar r a {-}
Importar.Ent.Sumar i UNO i
sino
fijar r a {~}
fin
finbucle
si son iguales r y {~}
llamar Escribir {~} finargs
fin
llamar Escribir {0} finargs

Explain:

Read a number from STDIN;
If the number is zero (0); Then:
    Writes 0 to STDOUT and exits;
End If;
If the number is less than zero (0); Then:
    Set the fill character to "~";
Else:
    Set the fill character to "-";
End If;
For i = 0; While i is less than abs(number); do:
    Write the fill character to STDOUT;
    If the fill character is "~":
        Set the fill character to "-"
        Increment i by one
    Else:
        Set the fill character to "~"
    End if;
End for;
If the fill character is "~"; Then:
    Write "~" to STDOUT;
End If;
Write "0" to STDOUT
Source Link

PseudoD, 688 bytes

utilizar mate.pseudo
utilizar entsal.pseudo
adquirir numero
adquirir abs
adquirir relleno
adquirir indice
fijar numero a llamar LeerPalabra finargs
si son iguales numero y CERO
llamar EscribirLinea {0} finargs
salir
fin
fijar abs a llamar ValorAbsoluto numero finargs
fijar indice a CERO
si comparar Importar.Ent.Comparar numero < CERO
fijar relleno a {~}
sino
fijar relleno a {-}
fin
mientras comparar Importar.Ent.Comparar indice < abs
llamar Escribir relleno finargs
si son iguales relleno y {~}
fijar relleno a {-}
Importar.Ent.Sumar indice UNO indice
sino
fijar relleno a {~}
fin
finbucle
si son iguales relleno y {~}
llamar Escribir {~} finargs
fin
llamar EscribirLinea {0} finargs

Explain:

Read a number from STDIN;
If the number is zero (0); Then:
    Writes 0 to STDOUT and exits;
End If;
If the number is less than zero (0); Then:
    Set the fill character to "~";
Else:
    Set the fill character to "-";
End If;
For i = 0; While i is less than abs(number); do:
    Write the fill character to STDOUT;
    If the fill character is "~":
        Set the fill character to "-"
        Increment i by one
    Else:
        Set the fill character to "~"
    End if;
End for;
If the fill character is "~"; Then:
    Write "~" to STDOUT;
End If;
Write "0" to STDOUT