Enter time to bottom: -
Shaft depth is ??
Do you want to take another measure (Y/N)?
any1 can write this code in C for me ?
the acceleration of gravity is 9.81 * time^2 / 2
thank you
C programming?
Hmmm it seems like you are wanting to do this the easy way but not doing it and I will regret giving you this code for cheating purposes but I'm in a good mood...
#include %26lt;stdio.h%26gt;
#include %26lt;math.h%26gt;
#define GRAVITY 9.81
main()
{
double time1;
char again;
while (1)
{
printf("Enter time to bottom: \n");
scanf("%f", %26amp;time1);
distance = GRAVITY * (pow(time1, 2) )/ 2;
printf("Shaft depth is %lf.\n", distance);
printf("Do you want to take another measure (Y/N).\n");
scanf("%c", %26amp;again);
if (again == 'N' || again == 'n')
{
exit(100);
}
}
}
Reply:If this is your class assignment. DIY
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment