Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2015 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9284017644567c29c7f8 to your computer and use it in GitHub Desktop.
Save anonymous/9284017644567c29c7f8 to your computer and use it in GitHub Desktop.
import Foundation
public class bmi {
public static func pounds(weight: Double, height: Double) {
let Height = height * height
let thirds = weight / Height
let result = thirds * 703
print(result)
if (result <= 18.4) {
print("You are underweight.")
} else if (result <= 25.1) {
print("You are normal.")
} else if (result <= 29.9) {
print("You are obeest.")
} else if (result >= 29.9) {
print("You are MORBIDLY OBEEST.")
} else {
print("You've managed to break the machine.")
}
}
public static func kilograms(weight: Double, height: Double) {
let Height = height * height
let result = weight / Height
print(result)
if (result <= 18.4) {
print("You are underweight.")
} else if (result <= 25.1) {
print("You are normal.")
} else if (result <= 29.9) {
print("You are obeest.")
} else if (result >= 29.9) {
print("You are MORBIDLY OBEEST.")
} else {
print("You've managed to break the machine.")
}
}
}
print("Pounds:")
print(bmi.pounds(150, height: 65))
print("Kilograms:")
print(bmi.kilograms(68.0, height: 1.65))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment