#!/usr/bin/env ruby # -*- coding: utf-8 -*- puts "標準のWは?" w = gets.to_f printf("%dWで何秒?\n", w) t = gets.to_f puts "何Wで加熱する?" c = gets.to_f def henkan(x,y,z) ans = x * y / z end printf("加熱には%fJ必要\n",w*t) printf("%dWで%f秒加熱\n", c, henkan(w,t,c))