/* * Project1.Ch3.txt * By: John Stile * (a) Write a function named getfl that asks the user for a float number and returns the value to whereever the function is called. * (b) Write a program that employs getfl five times to obtain five floati values from the user, assigning each to different variables. * (c) Output the 5 numbers and their average. */ #include // include functions from stidio.h when compiling this program #define NUM 5 // preprocessor will search and replace NUM with 5 before compiling program. float getfl(void) // header for function getfl, takes nothing, returns an float. { float number; // declare variable number that will store a float. printf("Please enter a number: "); // Ask the user for input scanf("%f", &number ); // record input in float return number; // return value in number to the calling function } int main(void) { float numbers[NUM]; // declare an array of floats with 5 members. int i; // declare an int variable named i. i will be used in a for loop. float average; // declare the floating point variable average. float total=0; // declare the floating point variable total, to hold sum of all enteries, and assign value of 0. // call the function getfl five times, // each time assing the return value to an element of the array numbers. for(i=0; i