/* * Chapter3, Assignment 4. * By John Stile * Write a function called dif2 that accepts 2 floating point arguments, * subtracts the first from the second, * and then output the difference. * Put the function in a program and make it work. * Comment the code. * Program is called Assignment.problem4.Ch3.c */ #include // include functions in stdio.h when compiling. void dif2(float xx, float yy) // header for function dif2, takes 2 floats refered to as xx and yy, returns nothing. { float zz; // declare floating point variable zz zz=xx-yy; // assign zz the difference between the values in xx and yy. printf("%f\n", zz); // print the resulting value in zz. } // end function int main(void) // header for function main. takes nothing, returns an integer { float vv, ww; // declare floating point variable vv and ww. printf ("Enter first floating point number. " ); // Ask user to enter number scanf("%f", &vv); // store the number input at the memory address of pointed to by vv printf ("Enter second floating point number. " ); // Ask user to enter number scanf("%f", &ww); // store the number input at the memory address of pointed to by ww dif2( vv, ww); // Call the function dif2, sending it the value stored in vv and ww. return 0; // return a value of 0 to the colling program. }