You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
610 B
34 lines
610 B
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <math.h>
|
|
#include "funktionen.h"
|
|
|
|
// Function to calculate the square of a number
|
|
float square(float x) {
|
|
return x * x;
|
|
}
|
|
|
|
float squareRoot(float x) {
|
|
if (x >= 0) {
|
|
return sqrt(x);
|
|
} else {
|
|
printf("Error: Invalid input for square root!\n");
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
// Function to calculate the cube of a number
|
|
float cube(float x) {
|
|
return x * x * x;
|
|
}
|
|
|
|
// Function to calculate the cube root of a number
|
|
float cubeRoot(float x) {
|
|
return cbrt(x);
|
|
}
|
|
|
|
// Function to calculate the absolute value of a number
|
|
float absolute(float x) {
|
|
return fabs(x);
|
|
}
|