练习2-6计算物体自由下落的距离。

一个物体从100米的高空自由落下,求它在前3秒内下落的垂直距离,设重力加速度为10m/s平方。试编写相应程序。

#include <stdio.h>
int height(t)//定义函数height
{
    int g=10;
    return g*t*t/2;//返回值
}
int main()
{
    int h;
    int t;
    scanf("%d",&t);
    h=height(t);
    printf("%d\n",h);

    return 0;
}
发布了14 篇原创文章 · 获赞 2 · 访问量 280

猜你喜欢

转载自blog.csdn.net/qq_45969772/article/details/104674508
2-6