CSE110 Summer Session I
Homework #1: Input/Output
Due Friday, May 26 2001
NOTE: Please remember to provide relevant comments on all
programs
Also, name your files hw1p1.c, hw1p2.c, hw1p3.c
/html/courses/cse110/hw1p1 /html/courses/cse110/hw1p2 /html/courses/cse110/hw1p3
1. [20 Points] Write a program which prints out the following variant of "Hello World".
% a.out Hello there, Peter. Hello there, Bob. Hello there, Bunny. %
2. [30 Points] Write a program which takes an integer from the keyboard input and prints the cube of that number to the screen output (the cube of a number is that number multipled by itself three times. A sample screen run of the program is below.
% a.out Enter an Integer: 3 3 cubed is 27 % a.out Enter an Integer: 4 4 cubed is 64 %
3. [50 Points] Write a program which inputs two integers, and prints out the larger of the two (if the two numbers are equal, print the value.) A sample screen run of the program is as follows:
% a.out first number? 3 second number? 5 5 is the larger number % a.out first number? 5 second number? 4 5 is the larger number % a.out first number? 6 second number? 6 6 is the larger number