Ruby - Numbers - Sum and Product.txt - class Screen def cls puts\\n 2 puts\\a end end Console_Screen = Screen.new Console_Screen.cls print\"Hello Please

Ruby - Numbers - Sum and Product.txt - class Screen def cls...

This preview shows page 1 - 2 out of 2 pages.

class Screen def cls puts ("\n" * 2) puts ("\a") end end Console_Screen = Screen.new Console_Screen.cls print "Hello! Please provide three non-zero numbers. I will do the rest!\n\n (Press Enter to continue)" STDIN.gets loop do Console_Screen.cls print "Please give me your first number. \n\n:" $number1 = STDIN.gets $number1.chop! if $number1.to_f != 0 print "Your first number is " + $number1 + "." break end end loop do Console_Screen.cls print %Q{Please give me your second number. \n\n:} $number2 = STDIN.gets $number2.chop! if $number2.to_f != 0 print "Your second number is " + $number2 + "." break end end loop do Console_Screen.cls print %Q{Please give me your third number. \n\n:} $number3 = STDIN.gets

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture