UMBC CMSC 201 Fall '06 CSEE | 201 | 201 F'06 | lectures | news | help |
/******************************************** * File: findstats.c * Author: S. Bogar * Date: 8/3/99 * Section 101 * EMail: bogar@cs.umbc.edu * * This file contains the main program which gets two * integers from the user and then reports statistics * about these integers. * * This file makes use of functions found in a * separately-compiled object file. *********************************************/ #include <stdio.h> /* stats.h contains function prototypes */ #include "stats.h" int main () { int a, b ; /* get two ints from user */ printf("Enter first number: ") ; scanf ("%d", &a) ; printf("Enter second number: ") ; scanf ("%d", &b) ; printf("\n") ; /* call arithmetic functions and print results */ printf("The sum of %d and %d is: %d\n", a, b, Sum (a, b) ) ; printf("The smaller of %d and %d is: %d\n", a, b, Min (a, b) ) ; printf("The larger of %d and %d is: %d\n", a, b, Max (a, b) ) ; printf("The average of %d and %d is: %f\n", a, b, Avg (a, b) ) ; printf("The distance between %d and %d is: %d\n", a, b, Dist (a, b) ) ; /* we're done !! */ printf("That's all folks.\n") ; return 0; }