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.
25 lines
523 B
25 lines
523 B
#include "fakultaet.h"
|
|
|
|
int berechneFakultaetInt(int zahl) {
|
|
if (zahl == 0 || zahl == 1) {
|
|
return 1;
|
|
} else {
|
|
int fakultaet = 1;
|
|
for (int i = 2; i <= zahl; ++i) {
|
|
fakultaet *= i;
|
|
}
|
|
return fakultaet;
|
|
}
|
|
}
|
|
|
|
int berechneFakultaetDouble(double zahl) {
|
|
if (zahl == 0 || zahl == 1) {
|
|
return 1;
|
|
} else {
|
|
double fakultaet = 1;
|
|
for (double i = 2; i <= zahl; ++i) {
|
|
fakultaet *= i;
|
|
}
|
|
return fakultaet;
|
|
}
|
|
}
|