实验一 邵铭修 202383310026

task1
}

点击查看代码
#include<stdio.h>
int main() {
	printf("o\n");
	printf("<H>\n");
	printf("I I\n");
	printf("o\n");
	printf("<H>\n");
	printf("I I\n");


	return 0;

![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316103510979-1614612527.png)
点击查看代码
#include<stdio.h>
int main() {
	printf(" O       O\n");
	printf("<H>     <H>\n");
	printf("I I     I I\n");


	return 0;
}
![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316103618545-754736024.png)

task2

点击查看代码
#include<stdio.h>
#include<stdlib.h>
#define _CRT_SECURE_NO_WARNINGS
 int main()
 {
 float a, b, c;
 scanf_s("%f%f%f", &a, &b, &c);

  if ((a + b > c) && (b + c > a) && (a + c > b))
		   printf("能构成三角形\n");
	 else
		   printf("不能构成三角形\n");
	
		system("pause");
	
	return 0;
 }
![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316104558773-1311175097.png)

task3

点击查看代码
![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316104808756-1778003700.png)

![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316104814131-434171678.png) ![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316104922030-1579968228.png)

task4

点击查看代码
#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
    double x, y;
    char c1, c2, c3;
    int a1, a2, a3;

    scanf("%d%d%d", &a1, &a2, &a3);
    printf("a1 = %d, a2 = %d, a3 = %d\n", a1, a2, a3);

    scanf("%c%c%c", &c1, &c2, &c3);
    printf("c1 = %c, c2 = %c, c3 = %c\n", c1, c2, c3);

    scanf("%lf,%lf", &x, &y);
    printf("x=%lf, y=%lf\n", x, y);

    return 0;
}

![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316105512097-806756298.png)

task5

点击查看代码
#include <stdio.h>

int main()

{
    int year;
    year = 1000000000 / (3600 * 24 * 365);
    printf("10亿秒约等于%d年\n", year);
    return 0;
}
![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316105558754-244152005.png)

task6

点击查看代码
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
    double x, ans;

    while (scanf("%lf", &x) != EOF)
    {
        ans = pow(x, 365);
        printf("%.2f的365次方: %.2f\n", x, ans);
        printf("\n");
    }
    return 0;
}
![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316105815311-733376790.png)

task7

点击查看代码
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<math.h>
#include<stdlib.h>

int main() {
    double C, F;

    while (scanf("%lf", &C) != EOF)
    {
        F = 9.0 / 5 * C + 32;
        printf("摄氏度C=%.2f时,华氏度F=%.2f\n", C, F);
        printf("\n");
    }

    return 0;
}
![](https://img2024.cnblogs.com/blog/3405472/202403/3405472-20240316110141232-1740139385.png)

TASK8

点击查看代码
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>


int main()
{
    double a, b, c, s, area, x;
    while (scanf("%lf%lf%lf", &a, &b, &c) != EOF)
    {
        s = (a + b + c) / 2;
        x = s * (s - a) * (s - b) * (s - c);
        area = sqrt(x);
        printf("a=%.3lf,b=%.3lf,c=%.3lf,area=%.3lf", a, b, c, area);
    }

    return 0;
}

posted @ 2024-03-16 11:08  MINXZBC  阅读(6)  评论(0编辑  收藏  举报