Sum of Many Numbers
This is a pair exercise and must be competed in your
tutorial or lab with your partner.
For this activity,
you will create a program
called loopSum.c
which will first read in the number of values to scan,
and then scan in that many other values,
and add them together,
then show the sum.
For example:
How many numbers: 2 1 2 3
How many numbers: 3 -3 4 13 14
How many numbers: 5 -2 -1 0 1 2 0
To run some simple automated tests:
$ 1511 autotest loopSum
To run Styl-o-matic:
$ 1511 stylomatic loopSum.c Looks good!
You’ll get advice if you need to make changes to your code.
Submit your work with the give command, like so:
$ give cs1511 wk04_loopSum
Or, if you are working from home, upload the relevant file(s) to the wk04_loopSum activity on Give Online.