Addition Calculator
This is a pair exercise and must be competed in your
tutorial or lab with your partner.
Create a program called addition.c
.
This program should ask for two integers
using the message
Please enter two integers:
then display the sum of the integers as
n + n = sum
.
Make sure to replace the n with the numbers entered in the same order and the sum with the sum of the two numbers.
Some Examples
$ ./addition Please enter two integers: 2 5 2 + 5 = 7
$ ./addition Please enter two integers: 3 5 3 + 5 = 8
$ ./addition ./addition Please enter two integers: -1 5 -1 + 5 = 4
To run some simple automated tests:
$ 1511 autotest addition
To run Styl-o-matic:
$ 1511 stylomatic addition.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 wk02_addition
Or, if you are working from home, upload the relevant file(s) to the wk02_addition activity on Give Online.