Task One:
Write a function that is passed four integer inputs representing two different time periods (each
expressed as a number of minutes and seconds). The function should calculate and return the
difference between those two time periods (expressed as a number of seconds).
Function prototype declaration:
int SecondsBetween(int minuteA, int secondA, int minuteB, int secondB)
Assumptions:
You can assume that all four input values will be greater than or equal to 0.
Example:
int result1, result2, result3;
result1 = SecondsBetween(5, 45, 7, 35);
result2 = SecondsBetween(7, 35, 5, 45);
result3 = SecondsBetween(0, 0, 10, 0);
printf("%d %d %d \n", result1, result2, result3);
Expected output:
110 110 600
Task Two:
Write a function that is passed four inputs: an array of integers, the number of elements in the array,
a low value and a high value. The function should calculate and return the sum of every element in
the array that is between low and high (inclusive). In other words, you must calculate the sum of all
values in the array that are greater than or equal to the value of low and less than or equal to the
value of high. Any value that falls outside of that range should be ignored when you calculate the
sum.
Function prototype declaration:
int SumInRange(int *values, int numValues, int low, int high)
Assumptions:
You can assume that there will be at least one element in the input array and that the
value of low will be less than or equal to the value of high.
Example:
int numbers[11] = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5};
int result1, result2, result3; result1 = SumInRange(numbers, 11, 0, 100);
result2 = SumInRange(numbers, 11, -2, 2);
result3 = SumInRange(numbers, 11, -4, -4);
printf("%d %d %d \n", result1, result2, result3);
Expected output:
15 0 -4
Task Three:
Write a function that is passed two inputs: an array of integers, and the number of elements in the
array. The function should return the number of distinct (i.e. different) values that exist in the array.
Function prototype declaration
: