Assignment 1

1.1 Write a program that first takes in a number n as input from the keyboard. It then takes in n integers as input from the keyboard and outputs their sum and average to the diplay.

1.2 Write a program that swaps two variables a and b. The initial values of a and b are obtained from the keyboard. The program puts the initial value of a into b's memory location and the initial value of b into a's memory location. It then prints out the new values of a and b.

1.2(Extra Credit) Do problem 1.2 without using any temporary storage when swapping.

1.3 Write a program that takes in two numbers as input and computes their greatest common divisor.

1.4 Exercise 2.13 in the textbook.

1.5 Exercise 2.10 in the textbook.