From 1a2e13f0c74a65bef60b88425037d4eff3cd7d1d Mon Sep 17 00:00:00 2001 From: fdai7782 Date: Fri, 2 Feb 2024 16:03:53 +0000 Subject: [PATCH] Added squareRootFunction for calculating square roots --- src/main/c/main_taschenrechner.c | 7 +++++++ src/main/c/taschenrechner.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/main/c/main_taschenrechner.c b/src/main/c/main_taschenrechner.c index d9bda36..af494d1 100644 --- a/src/main/c/main_taschenrechner.c +++ b/src/main/c/main_taschenrechner.c @@ -22,6 +22,13 @@ int divide(int a, int b) { return a / b; } +// Square root function +double squareRootFunction(double x) { + // Using the sqrt function from math.h + return sqrt(x); +} + +//.. // Trigonometric functions double sineFunction(double angle) { // Convert degrees to radians for trigonometric functions diff --git a/src/main/c/taschenrechner.h b/src/main/c/taschenrechner.h index 76acfb3..1053da9 100644 --- a/src/main/c/taschenrechner.h +++ b/src/main/c/taschenrechner.h @@ -9,6 +9,10 @@ int multiply(int a, int b); int divide(int a, int b); +// Square root function +double squareRootFunction(double x); + +//.. // Trigonometric functions double sineFunction(double angle);