Skip to content
Snippets Groups Projects
Forked from Configs / EC327 / Labs / Current
86 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
LabTwo_ChapterSix.h 744 B
//
// Created by Ari Trachtenberg on 9/10/24.
//

// CHAPTER 6

/**
 * @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);