@ -57,3 +57,17 @@ return 0;
float power(float x, float y) {
return pow(x, y);
}
// Function to calculate the factorial of a number
int factorial(int x) {
if (x >= 0) {
int result = 1;
for (int i = 1; i <= x; i++) {
result *= i;
return result;
} else {
printf("Error: Invalid input for factorial!\n");
return 0;