From 5f4690b00472e50e1f1497f4e705d96f4a5aa57e Mon Sep 17 00:00:00 2001 From: Khaled Date: Sun, 4 Feb 2024 21:46:07 +0100 Subject: [PATCH] squareRootPlusOne --- src/c/funktionen.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/c/funktionen.c b/src/c/funktionen.c index 3d33778..d3e8510 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -154,3 +154,13 @@ float naturalLogarithmPlusOne(float x) { } } +// Function to calculate the square root of a number and add 1 +float squareRootPlusOne(float x) { + if (x >= 0) { + return sqrt(x) + 1; + } + else { + printf("Error: Invalid input for square root + 1!\n"); + return 0; + } +}