Question: // gcc -Wall sum6.c -o sum6 // ./sum6 4 8 -5 0 20 // prints: Sum=27 Sum2=505 Sum3=8451 #include #include static void sum6(int argc, char

 // gcc -Wall sum6.c -o sum6 // ./sum6 4 8 -5

// gcc -Wall sum6.c -o sum6 // ./sum6 4 8 -5 0 20 // prints: Sum=27 Sum2=505 Sum3=8451

#include #include

static void sum6(int argc, char *argv[], int *x, int *y, int *z) { TBD }

int main(int argc, char *argv[]) { int x, y, z; TBD printf("Sum=%d Sum2=%d Sum3=%d ", x, y, z); return 0; }

You have been given 8 C files, each has the same logic, expressed in different ways. Each of the files is incomplete, marked by TBD. You must replace each TBD entry with appropriate C code. You must NOT alter any of the existing lines. You are only allowed to replace each TBD line with new lines.

Each of the C programs do exactly the same task. Given a list of numbers on the command line, they find the sum, sum of squares and the sum of cubes. You do not have to add error checking. You can safely assume that all numbers are given nicely as integers on the command line and are in the range of -100 to 100.

sumb.c 1 // gcc - Wall sumb.c -o sum6 2 // ./ sum6 4 8 -5 20 3 // prints: Sum-27 Sum2=505 Sum3=8451 4 5 #include 6 #include 7 8 static void sum6(int argc, char *argv[], int *x, int *y, int *z) { 9 TBD 10} 11 12 int main(int argc, char *argv[]) { 13 int x, y, z; 14 TBD 15 printf("Sum=%d Sum2=%d Sum3=%d ", x, y, z); 16 return 0; 17 18 |

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!