Beauty of Mathemazic in F#

[code]#light
let mathsPuzzle() =
print_string "Enter day of the month on which you were born: "
let input = read_int ()
let x = input * 4 // Multiply it by 4
let x = x + 13 // Add 13
let x = x * 25 // Multiply the result by 25
let x = x - 200 // Subtract 200
print_string "Enter number of the month you were born: "
let input = read_int ()
let x = x + input
let x = x * 2 // Multiply by 2
let x = x - 40 // Subtract 40
let x = x * 50 // Multiply the result by 50
print_string "Enter last two digits of the year of your birth: "
let input = read_int ()
let x = x + input
let x = x - 10500 // Finally, subtract 10,500
printf "Date of birth (ddmmyy): %i" x
mathsPuzzle()[/code]
上述代码保存为samples.fs.
在F# Version 1.9.2.9 ;.Net Framework Version v2.0.50727环境下用fsc.exe编译器。

收藏与分享

关于 pitt

不慌..不乱.. 请相信Pitt....
此条目发表在 Daily Life 分类目录,贴了 标签。将固定链接加入收藏夹。

Beauty of Mathemazic in F#》有 0 条评论

发表评论

电子邮件地址不会被公开。 必填项已被标记为 *

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>