Hey guys, I am suppose to do this but I am stuck, any help would be appreciated.
1 - Sum of Squares
Write a function called sumSquares that returns the sum of the squares of its float array parameter. The function should have a second parameter for the size of the array.
Example
Code:
const int MAX_WORD = 10;
const int ROW = 3;
const int COLUMN = 4;
const int SS1 = 4;
const int SS2 = 1;
const int SORTED1 = 8;
const int SORTED2 = 1;
const int SORTED3 = 5;
int main()
{
// Sum of Squares Tests----------------------------
float ssArray1[SS1];
float ssArray2[SS2];
printf("sum of squares test 1: enter %d numbers\n", SS1);
for(int i = 0; i < SS1; ++i){
scanf("%f",&ssArray1[i]);
}
printf("sum of squares = %.2f\n", sumSquares(ssArray1, SS1));
printf("\nsum of squares test 2: enter %d numbers\n", SS1);
for(int i = 0; i < SS1; ++i){
scanf("%f",&ssArray1[i]);
}
printf("sum of squares = %.2f\n", sumSquares(ssArray1, SS1));
printf("\nsum of squares test 3: enter %d numbers\n", SS2);
for(int i = 0; i < SS2; ++i){
scanf("%f",&ssArray2[i]);
}
printf("sum of squares = %.2f\n", sumSquares(ssArray2, SS2));
// Sorted Tests------------------------------------