diff --git a/problems/LabTwo_ChapterSix.h b/problems/LabTwo_ChapterSix.h index bccac8dcb8df426a1af1e54b9a75ff0969c31fe4..b7673eeaa12916dc0d2d946c8bda087211b6e2a9 100644 --- a/problems/LabTwo_ChapterSix.h +++ b/problems/LabTwo_ChapterSix.h @@ -1,8 +1,29 @@ // -// Created by Ari Trachtenberg on 9/16/24. +// Created by Ari Trachtenberg on 9/10/24. // -#ifndef PUBLIC_LABTWO_CHAPTERSIX_H -#define PUBLIC_LABTWO_CHAPTERSIX_H +// CHAPTER 6 -#endif //PUBLIC_LABTWO_CHAPTERSIX_H +/** + * @param arr An array of integers + * @param size The number of integers stored in array [arr] + * @return The sum of the following for [arr]: + * * Every element at even index. + * * Every even element. + * * The product of the first and last element. + * + * @example 1 + * int test[] = {1,2,3}; + * labSix_pZero(test,3) returns 9 as the sum of: + * * 1+3 (elements at even index) + * * 2 (even elements) + * * 3 (first*last element) + * + * @example 2 + * int test2[] = {1,2,3,4}; + * labSix_pZero(test,5) returns 14 as the sum of: + * * 1+3 (elements at even index) + * * 2+4 (even elements) + * * 4 (first*last element) + */ +int labSix_pZero(int arr[], int size); \ No newline at end of file