diff --git a/BMI_TAhmad b/BMI_TAhmad index d015cc4..1945f69 100644 --- a/BMI_TAhmad +++ b/BMI_TAhmad @@ -1 +1,32 @@ -Hello this is a test. \ No newline at end of file +<<<<<<< Updated upstream +calculate_bmi <- function(weight_kg, height_m) { +======= +# Calculate BMI +bmi <- calculate_bmi(weight_kg, height_m) +print(paste("The BMI is", bmi))calculate_bmi <- function(weight_kg, height_m) { +>>>>>>> Stashed changes + # Check if the input values are valid + if(weight_kg <= 0 || height_m <= 0) { + stop("Weight and height must be greater than zero.") + } + + # Calculate BMI + bmi <- weight_kg / (height_m^2) + + # Return the calculated BMI + return(bmi) +} + +<<<<<<< Updated upstream +#Example +# weight in kilograms +weight_kg <- 70 +# height in meters +height_m <- 1.75 +======= +# Example usage: +# weight in kilograms +weight_kg <- 70 +# height in meters +height_m <- 1.75 +>>>>>>> Stashed changes