Excercises_GeorgMandl/BSP_1_C/bsp_1_c.h

26 lines
951 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef BSP_1_C_H_INCLUDED
#define BSP_1_C_H_INCLUDED
//
/** \brief Funktion zur Berechnung der Summe aller Vielfachen von 3 und 5, kleiner als n via for loops
*
* \param[in] n obere Schranke für die Zahlen, welche aufsummiert werden sollen
* \return Summe der Vielfachen (<=n) von 3 und 5
*
*/
long long int fkt1(const long long int n);
//
/** \brief berechnet die gesuchte Summe ausschließlich nach einer Formel / ohne loops. Berechnung via Formel;
// schreibt Summe der durch 3 teilbaren Zahlen an, hebt 3 heraus und braucht dann nur mehr
// die Summe von 1 bis n/3 abgerundet zu addieren; hierfür verwende die Gauß´sche Summenformel
// und integer Division; analog für 5 und 15
*
* \param[in] n obere Schranke für die Zahlen, welche aufsummiert werden sollen
* \return Summe der Vielfachen (<=n) von 3 und 5
*
*/
long long int fkt2(const long long int n);
#endif // BSP_1_C_H_INCLUDED