From 3274edbaf4d1a234f4bbdbd818500e14fa044a8c Mon Sep 17 00:00:00 2001 From: Ari Trachtenberg Date: Fri, 20 Sep 2024 16:03:23 -0400 Subject: [PATCH] starting to add lab 2 --- problems/LabTwo_ChapterSix.h | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/problems/LabTwo_ChapterSix.h b/problems/LabTwo_ChapterSix.h index bccac8d..b7673ee 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 -- GitLab