Skip to content

Instantly share code, notes, and snippets.

@benwoody
Created August 30, 2011 21:58
Show Gist options
  • Save benwoody/1182196 to your computer and use it in GitHub Desktop.
Save benwoody/1182196 to your computer and use it in GitHub Desktop.
Alcohol Content finder
#!/usr/bin/env ruby
og = ARGV[0].to_f #first argument
fg = ARGV[1].to_f #second argument
if og or fg == nil
puts "usage: ./peralc.rb \'original gravity' \'final gravity'"
Process.exit
end
peralc = ((( 1.05 * ( og - fg )) / fg ) / 0.79) * 100
printf('%.02f', peralc)
puts "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment