#include #define g -9.8 /***************************************************** Program C13.c, written by C.S. Thaxton Last modified: 8/25/04, 10:00am This program computes the final velocity of a falling object given the initial velocity and a final time of interest user-prompted input: initial time initial velocity final time of interest output: final velocity (to the screen) variables: t_init - initial time [s] (hardcoded to 0) t_final - final time [s] v_init - initial velocity [m/s] v_final - final velocity [m/s] g - gravitational acceleration [m/s/s] (#define) again - character prompt (control) dependencies: stdio.h *****************************************************/ int main() //use int main() only with return INT; at end { // Messages for initial display char message1[100]="Free Fall Final Velocity Computation\n"; char message2[100]="C.S.Thaxton\n"; char again='y'; // Loop control // Define variables as float (accuracy not an issue) float t_init=0.0; // HARDCODE t-init to 0 float t_final, v_init, v_final; // Loop through to allow for multiple computations printf("%s",message1); printf("%s",message2); while (again=='y') { // Prompt user for input printf("\nPlease enter the initial velocity [m/s]: "); scanf("%f",&v_init); printf("\nPlease enter the final time [s]: "); scanf("%f",&t_final); // Compute final velocity v_final=v_init+g*(t_final-t_init); // Print final result printf("\nThe final velocity is [m/s]: %f",v_final); // Prompt for loop printf("\n\nWould you like to do another [y/n]: "); scanf("%s",&again); } // Terminate return(0); }