/* * project5.c * Chapter 4 * John Stile * Purpose: Write a program that asks the user for the number of seconds(1-15) * that an object falls near the surface of the Earth. * The program calculates and then outputs the distance the object will * fall in the supplied number of seconds. * * Distance=1/2 * 32 * t * t //where t is seconds of fall. */ #include int main(void) { float seconds,distance; printf("Enter number of seconds the object will fall (from 1-15)\n"); scanf("%f", &seconds); if ( seconds<1 || seconds >15) { printf("That is not a valid number!\n"); return 1; } distance=(float) 1 / 2 * 32 * (seconds * seconds); printf("The distance the object will fall in %.2f seconds is %.2f\n", seconds, distance); return 0; }