diff --git a/src/ProduktSumme.c b/src/ProduktSumme.c index 0899097..3b8be64 100644 --- a/src/ProduktSumme.c +++ b/src/ProduktSumme.c @@ -30,4 +30,18 @@ int berechneProdukt(int start, int ende) { } } return produkt; +} + +int berechneSumme(int start, int ende) { + + if (start > ende) { + return 0; + } + + int summe = 0; + for (int i = start; i <= ende; i++) { + summe += i; + } + + return summe; } \ No newline at end of file