Introduction to Computer Science - Fall Semester 1998/9 Exercise 1

Due: 24/12/1998

Note: You are to submit printouts of the source codes of the programs along with printouts of a demonstrated running of each program. ^{1}

Ex 1.1 Identifiers

Which of the following are legal identifiers and why:

3id      _yes            0_no_o_no    00_go     star*it
1_i_am   one_i_aren't    xYshouldI    me_to-2   int

Ex 1.2 Rectangle

Write a program that asks the user for values of three sides of a box (in cm), and outputs the volume (in cubic meters).

Ex 1.3 Unit conversion

Write a conversion program that asks the user for a value in pounds, and then converts it to kgs. 1 pound = 0.4536 kg .

Ex 1.3 ASCII

Write a program that asks the user for a capital letter, and then prints the same later uncapitalized. (hint: the ASCII value of ’a’ is equal to the ASCII value of ’A’+32).

1Course web-page: http://www.math.tau.ac.il/~dinur/C/fall98-9.html