/* * Project1.c * Chapter 5 * John Stile * Purpose: Write a program that employes the function to get two floats from * the user, then calculates the product, then output the product to * the screen. */ #include float product(float xx, float yy) // header for function product, takes 2 floats, returns one float { return xx*yy; // multiply yy by xx, and return output to calling function } int main(void) { float zz,xx,yy; // declare floating point variables xx and yy printf("Please enter first floating point number: "); // prompt for input scanf("%f", &xx); // input first float getchar(); // strip NULL from input buffer printf("Please enter second floating point number: "); // prompt for input scanf("%f", &yy); // input second float getchar(); // strip NULL from input buffer zz=product(xx,yy); printf("The product of xx and yy = %12f*%12f = %12f\n", xx,yy,zz); }