From 2ac165d66725ae83035bf0c2d8f708d97c083356 Mon Sep 17 00:00:00 2001 From: "jakob.schratter" Date: Wed, 22 Oct 2025 15:40:38 +0200 Subject: [PATCH] added descriptions --- ex1C_summation_of_specified_numbers/special_sum.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ex1C_summation_of_specified_numbers/special_sum.h b/ex1C_summation_of_specified_numbers/special_sum.h index 49d579a..a77964b 100644 --- a/ex1C_summation_of_specified_numbers/special_sum.h +++ b/ex1C_summation_of_specified_numbers/special_sum.h @@ -1,5 +1,18 @@ #include +/** + This function returns the sum of all positive integers less or equal n which are a multiples of 3 or of 5, WITH using a loop. + @param[in] n + @param[out] M +*/ size_t special_sum_loop(size_t n); + +/** + This function returns the sum of all positive integers less or equal n which are a multiples of 3 or of 5, WITHOUT using a loop. + Example: For n=15, we have 60 = 3+5+6+9+10+12+15 = (1+2+3+4+5)*3 + (1+2+3)*5 - 1*15 + Formula: M = (\sum_{i=1}^{k_3} i)*3 + (\sum_{i=1}^{k_5} i)*5 - (\sum_{i=1}^{k_15} i)*15 + @param[in] n + @param[out] M +*/ size_t special_sum_noloop(size_t n); \ No newline at end of file