Select The Function That Takes As Its Arguments The Following 1 An Array Of Floating Point Values 2 An Integer That 1 (49.64 KiB) Viewed 48 times
Select The Function That Takes As Its Arguments The Following 1 An Array Of Floating Point Values 2 An Integer That 2 (44.58 KiB) Viewed 48 times
Select the function that takes as its arguments the following: 1. an array of floating point values; 2. an integer that tells how many floating point values are in the array. The function should return as its value the sum of the floating point values in the array Example: If the array that is passed to the function looks like this: 0 1 2 3 4. 5.8 2.6 9.0 3.4 7.1 then the function should return the value 27.9 O sum(float all, int n) 0.0; float sumACC int i; for (i = 0; i<n; ++i) SUMACC += a;
O float sum(float all, int n) { float sumACC = 0.0; int i; for (i = 0; i < n; Hi) SUMACC += a; return sumACC; } o float sum(int n, a[]) { float sumACC = 0.0 int i; for (i = 0; i<n; ++i) sumACC += a; return sumACC; } o int sum(int a[], int n) { float sumACC = 0.0; int i; for (i = 0; i<n; ++i) SUMACC + a; return sumACC; 3
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!