<!DOCTYPE html> <html> <!-- Default style for pretty-print of text files --> <head><title>hanbun.rb</title> <style type="text/css"> pre {margin-left: 6ex;} pre span {counter-increment: linenum; text-align: right; position: relative;} pre span:before { position: absolute; right: 0px; background: #ddd; text-align: right; padding: 0 0.2ex; width: 5.5ex; margin-right: 0.5ex; content: counter(linenum) ":"; } </style> </head> <body> <p>[[ <a href="?showattc+article_m+129+raw">RAW TEXT</a>(DOWNLOAD here) ]]</p> <pre lang="en"> <span></span>#!/usr/bin/env ruby <span></span># -*- coding: utf-8 -*- <span></span> <span></span>deh hanbun(x) <span></span> x/2 <span></span> <span></span>puts "数値を入れてください。半分の値にします。" <span></span>y = gets.to_i <span></span>printf("%.1f\n", hanbun(y)) </pre> </body> </html>