Hello all, I am a complete newbie to this programming thing and am taking a intro class at school as required in my curriculum. I am having a problem where my input values are returning values of 0.000000 using a double variable in my code. Here is my code, any help would be much appreciated:
Code:#include <stdio.h> #include <math.h> int main(void) { double Vt,gravity,cOfDrag,mass,time; printf("This program will use a formula to calculate the velocity\n"); printf("of a skydiver with a given formula.\n"); printf("Please enter the mass of the diver in kg in the space provided below.\n"); scanf("%lf", &mass); printf("Please enter the coefficient of drag in kg/s in the space provided below.\n"); scanf("%lf", &cOfDrag); printf("Please enter the time of the flight in seconds in the space provided below.\n"); scanf("%lf", &time); gravity=9.8; Vt=((gravity*mass)/(cOfDrag))*(1-exp(-((cOfDrag/mass))*time)); printf("%lfkg is the value entered for mass.\n", &mass); printf("%lfkg/s is the value entered for coefficient of drag.\n", &cOfDrag); printf("%lfs is the value entered for time of flight.\n", &time); printf("%lfm/s is the velocity.\n", &Vt); system("pause"); return 0; }



LinkBack URL
About LinkBacks


