Homework 1

EENG 112/INFE 112

INTRODUCTION TO PROGRAMMING

HOMEWORK 1

1) Write a C-program that will sum a sequence of integers. Assume that the first integer which is read with scanf specifies the number of values remaining to be entered.

2) Write a C-program that would calculate and print the average of several integers. Assume the last value read in is the sentinel9999.

3) Write a C-program that prints the square of all numbers from Low to High given a step value of JUMP.

4) Write a C-program that finds and prints the sum of even and odd integers from 2 to 30 separately by using the switch selection.

5) Calculate the value of π(pi) from the infinite series π = 4 – 4/3 + 4/5 – 4/7 + 4/9 – 4/11 + ... for the first 15 terms.

NOTE : Submission of the homework should be made electronically to the e-mail address eeng112@emu.edu.tr