From 552010a1f94a4fec551d1425b0fcd567090c68b2 Mon Sep 17 00:00:00 2001 From: Ulriche Nguefack Date: Mon, 5 Feb 2024 21:57:45 +0100 Subject: [PATCH] exponent modulus logarithm potential calling --- src/main/c/Calculator/calculator.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/c/Calculator/calculator.c b/src/main/c/Calculator/calculator.c index 40c1b42..dc61a74 100644 --- a/src/main/c/Calculator/calculator.c +++ b/src/main/c/Calculator/calculator.c @@ -184,16 +184,32 @@ void displayMenu() { printf("19. Combination\n"); printf("20. Exit\n"); } -int add(int num1, int num2) { +double add(double num1, double num2) { return num1 + num2; } -int subtract(int num1, int num2) { +double subtract(double num1, double num2) { return num1 - num2; } -int multiply(int num1, int num2) { +double multiply(double num1, double num2) { return num1 * num2; } -int divide(int num1, int num2) { +double divide(double num1, double num2) { return num1 / num2; -} \ No newline at end of file +} + +double exponent(double base, double exponent) { + return pow(base, exponent); +} + +double modulus(double num1, double num2) { + return fmod(num1, num2); +} + +double logarithm(double num) { + return log(num); +} + +double potential(double base, double exponent) { + return pow(base, exponent); +}