-2
这是我的完整代码。无论我做什么,我都会为我的方程得到零。任何帮助将不胜感激。我一直从我的等式中得到零,不知道为什么
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
int x, y;
float a,t;
//Inputs
printf("What is the speed that the jet is traveling in km/hr? \nWhat is the distance traveled in meters? \n");
scanf("%d , %d", &x, &y);
//Calculations
a = x * 1/60 * 1/60 * 1/60 * 1000 ;
t = sqrt(y * a/2 ) ;
//Outputs
printf("The acceleration of the jet is %f meters per second squared. \n", a);
printf("The time it takes for the jet to reach takeoff speed is %f seconds. \n", t);
return 0;
}
'x'和'y'需要是'float',太。 – deamentiaemundi
您可能想要将整数除法改为浮点除法。在60年代之后添加一个点会照顾那个('60.')。 – Evert
@deamentiaemundi不一定,如果(由于某种原因)你想强制整数速度。后者虽然不被推荐。 – Evert