From 1333dc30ece6602b1705616e4d43b217252d7692 Mon Sep 17 00:00:00 2001 From: tahm563 <74535640+tahm563@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:18:57 +0100 Subject: [PATCH 1/2] Update BMI_TAhmad --- BMI_TAhmad | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/BMI_TAhmad b/BMI_TAhmad index d015cc4..6e4c5f8 100644 --- a/BMI_TAhmad +++ b/BMI_TAhmad @@ -1 +1,18 @@ -Hello this is a test. \ No newline at end of file +calculate_bmi <- function(weight_kg, height_m) { + # 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) +} + +#Example +# weight in kilograms +weight_kg <- 70 +# height in meters +height_m <- 1.75 From 7d8011706edcb646d706b81a3a492d5be43097d8 Mon Sep 17 00:00:00 2001 From: tahm563 Date: Wed, 10 Jul 2024 11:29:32 +0100 Subject: [PATCH 2/2] Update BMI_TAhmad --- BMI_TAhmad | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/BMI_TAhmad b/BMI_TAhmad index 6e4c5f8..1945f69 100644 --- a/BMI_TAhmad +++ b/BMI_TAhmad @@ -1,4 +1,10 @@ +<<<<<<< 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.") @@ -11,8 +17,16 @@ calculate_bmi <- function(weight_kg, height_m) { 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