Skip to content

Instantly share code, notes, and snippets.

@hiddenpower
Created April 24, 2013 18:20
Show Gist options
  • Save hiddenpower/5454297 to your computer and use it in GitHub Desktop.
Save hiddenpower/5454297 to your computer and use it in GitHub Desktop.
Ejercicio 1 Celsius a Fahrenheit y viceversa Imprimir pirámide de asteriscos
def ftoc(degree)
answer = ((degree -32) * 5.0 / 9.0).round(1)
puts answer
end
def ctof(degree)
answer = (degree * 9.0 / 5.0 + 32).round(1)
puts answer
end
def fact(n)
for i in 1..n
(n-i).times{printf " "}
for j in 1..i
printf "*"
end
puts""
end
end
@airvzxf
Copy link

airvzxf commented Apr 24, 2013

Oye Gus, te funciono el round(n)? Yo lo probé con ruby 1.8 y nada, creo que ese funciona en el 1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment