Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- float calculateSum(float age[]);
- int main() {
- float result, age[] = {23.4, 55, 22.6, 3, 40.5, 18};
- // age array is passed to calculateSum()
- result = calculateSum(age);
- printf("Result = %.2f", result);
- return 0;
- }
- float calculateSum(float age[]) {
- float sum = 0.0;
- for (int i = 0; i < 6; ++i) {
- sum += age[i];
- }
- return sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment