#!/usr/bin/env ruby # -*- coding: utf-8 x = rand(10) y = rand(10) p x p y printf("yは%dで、xは%dです。足したらいくつになりますか?\n",y,x) kotae = gets.to_i if kotae == (x+y) puts"せいかーい!" else puts"不正解...." end