CMSC 104, Sect. 0101

Homework 3: Your First C Program

Out: Monday, October 6, 2008
Due: Wednesday, October 15, 2008, before 5:00 PM
Note that late homeworks will NOT be accepted.

Objectives:


Assignment:


Submitting the Program

You do not have to turn in the sheet you used to fill in the blanks. However, you do have to submit your source code. Your C source code file MUST be called hw3.c. To submit your project, type the following at the Unix prompt. Note that the project name starts with uppercase 'H'. submit cs104_0101 Hw3 hw3.c To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show the file that you submitted in a format similar to the Unix 'ls' command. submitls cs104_0101 Hw3

The Program

/************************************************************** ** Filename: hw3.c ** Author: put your name here ** Date Written: 10/10/08 ** Section: put your section here ** E-mail: put your umbc e-mail address here ** Description: This program reads two integers numbers in ** from the user and perfoms some statistical ** analysis on the numbers. **************************************************************/ #include _____________ int main() { int _______ = 0; /* Stores the first number */ int _______ = 0; /* Stores the second number */ float average = 0.0; /* Stores the average of both numbers */ /* Read in an integer from the user */ printf("Please enter an integer: "); scanf("______", ________); /* Read in another integer from the user */ printf("Please enter another integer: "); scanf("______", ________); /* Determine which number is larger */ if( ________ > _______ ) { printf("%d is larger than %d.\n", _________, __________); } else if ( ___________ > ____________) { printf("%d is larger than %d.\n", _________, __________); } else { printf("%d and %d are equal. \n", _________, __________); } /* Determine the average of the two integers */ average = ___________________ / 2.0 ; /* Print the average */ printf("The average of %d and %d is _______.\n", num1, num2, average); return _________; }



Last modified: Monday, 22-Sep-2008 19:17:00 EDT