added descriptions
This commit is contained in:
parent
98908fc4b0
commit
2ac165d667
1 changed files with 13 additions and 0 deletions
|
|
@ -1,5 +1,18 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
|
/**
|
||||||
|
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);
|
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);
|
size_t special_sum_noloop(size_t n);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue