CMSC 104, Summer 2004
Homework 3
Due Date:
Tuesday, June 22, before 11:59 p.m.
Note: No late projects will be accepted.
The Objective
- To learn to use the gcc compiler
- To become familiar with syntax error messages generated by the gcc
compiler
The Task
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
'P'.
submit cs104 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 Hw3
The Program
/**************************************************************
** Filename: h3.c
** Author: put your name here
** Date Written: 6/17/04
** Section: 6080
** 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 if the first number is even or
odd and print the result */
if( ________ % ____ == ____)
{
printf("%d is an even number.\n", ________);
}
else
{
printf("%d is an odd number.\n", _________);
}
/* Determine the average of the two integers */
average = ________________ / ______;
/* Print the average to 2 decimal places*/
printf("The average of %d and %d is _______.\n", num1, num2, average);
return _________;
}