Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// 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

image text in transcribed

// 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions