Experiment 2-1-3 Calculate the free fall distance of an object (5 points)

An object fell freely from an altitude of 100 meters. Write a program to find the vertical distance it falls in the first 3 seconds. Let the acceleration of gravity be10米/秒2​​

Input format:

This question has not been entered.

Output format:

Output in the following format

height = 垂直距离值

The result is rounded to 2 decimal places.

Code:

# include <stdio.h>
# include <stdlib.h>
# include <math.h>

int main(){
    
    
    double height;
    int t = 3,g = 10;
    height = 0.5 * g * pow(t,2);
    printf("height = %.2lf",height);
    return 0;
}

Submit screenshot:

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43862765/article/details/114314741