scorpions_7 Posted July 3, 2014 Report Share Posted July 3, 2014 mi dudas es la siguientes hice este siguiente script #!/bin/bashs=1echo "ingrese edad"read edadfor ((i=$s;i<$edad;i+=+2)); doecho $idone ingreso la edad de 12 y me imprime todos los impares, lo que quiero hace es que me sume todos los impares y muestre el resultado Link to comment Share on other sites More sharing options...
cañangasñangas Posted July 3, 2014 Report Share Posted July 3, 2014 los imapes son 2i+1 con i perteneciente a los naturales, por lo tanto la idea seria suma = suma + (2i + 1) Link to comment Share on other sites More sharing options...
xomarx69 Posted July 3, 2014 Report Share Posted July 3, 2014 Para mantener tu código: #!/bin/bashs=1echo "ingrese edad"read edadsuma=0for ((i=$s;i<$edad;i+=+2)); dolet "suma+=$i"echo $idoneecho "total :$suma" Saludos Link to comment Share on other sites More sharing options...
scorpions_7 Posted July 23, 2014 Author Report Share Posted July 23, 2014 hola a todos tengo la siguiente dudas #!/bin/bash clear for a in $(seq 1 10)doecho "ingrese su nombre "read name doneclearecho $name~ como hago para que imprima todo los nombre y no el ultimo no mas ?? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now