C++
PHP
Java
Linux & UNIX
ColdFusion
Visual Basic
ActionScript
CGI/Perl
JavaScript
HTML/CSS
Other Languages
Bash
ASP
C
mySQL
Python
C#
Assembly
VB.NET
Scheme
Ruby
Conversion from Fahrenheit to Celsius and vise versa
Conversion into Bytes
Fibonacci Series
Factorial By Recursion
Fibonacci Sequence via Hash
Using lambda expressions and yield statements
Quadratic formula
Prime number finder
Palindrome tester
Mean median mode calculator
Greatest Common Factor/ Least common multiple
Mean, Median, and mode calculator
Distance converter
Code :
RUBY - CONVERSION FROM FAHRENHEIT TO CELSIUS AND VISE VERSA
Code Discription :
This program converts Fahrenheit to Celsius and Celsius to Fahrenheit
Right Click And Copy This Code
#PennyBoki @ puts "Please select " puts "A for Celsius to Fahrenheit" puts "B for Fahrenheit to Celsius" STDOUT.flush string0 = gets.chomp if string0 == "A" || string0 == "a" puts "Enter the temperature in Celsuis" STDOUT.flush string1 = gets.chomp x = string1.to_f y = 32+(9.0/5)*x puts "The temperature in Fahrenheit is "+y.to_s else if string0 == "B"|| string0 == "b" puts "Enter the temperature in Fahrenheit" STDOUT.flush string2 = gets.chomp x = string2.to_f y = (x-32)*(5.0/9) puts "The temperature in Celsius is "+y.to_s else puts "Invalid option." end end
COPYRIGHT © 2007-2008 BY Lib-Code.All rights reserved.
POWERED BY: Lib-Code V1.3