实验

1

 

 2

 3

 4

5

 

 

// 计算10亿秒约等于多少年,并打印输出
#include <stdio.h>
int main()
{
    int year;
    // 补足代码
    year = 1000000000 / 365 / 24 / 60 / 60;
    printf("10亿秒约等于%d年\n", year);
    return 0;
}

6

 

 

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

int main()
{
    double x, ans;

    while (scanf_s("%lf", &x) != EOF)
    {
        ans = pow(x, 365);
        printf("%.2f的365次方: %.2f\n", x, ans);
        printf("\n");
    }

    return 0;
}

7

 8

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


int main(void)
{
    float a, b, c, area, s;
    printf("输入 a,b,c:");
    scanf_s("%f %f %f", &a, &b, &c);
    s = (a + b + c) / 2;
    area = sqrt(s * (s - a) * (s - b) * (s - c));
    printf("a=%.2f,b=%.2f,c=%.2f,s=%.2f\n", a, b, c, s);
    printf("area=%.2f\n", area);

    return 0;

}

 

 

posted @ 2025-03-09 21:41  wangchenxu  阅读(8)  评论(0)    收藏  举报