/ Published in: Ruby

para sumar tres numbres
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def imprimir_menu puts" 1.sumar" end imprimir_menu puts "Elige Opcion" opcion = gets.chomp if opcion == "sumar" puts "Escribe el primer número" numero1 = gets.chomp.to_i puts "Escribe el segundo numero" numero2 = gets.chomp.to_i puts "Escribe el tercer numero" numero3 = gets.chomp.to_i sumar = numero1 + numero2 + numero3 puts "El resultado es #{sumar}" end
Comments
