实验一

实验任务1:

#include <stdio.h>
int main(){
	printf(" 0\n");
	printf("<H>\n");
	printf("I I\n");

	return 0;
} 

  实验截图如图

     image

       image

      image

  实验任务2:

#include <stdio.h>
int main() 
{
    double a, b, c;
    scanf("%lf%lf%lf", &a, &b, &c);
    if(a+b>c && a+c>b && b+c>a)
        printf("能构成三角形\n");
    else
        printf("不能构成三角形\n");

    return 0;
}

  截图如图

image

 image

实验任务3:

#include <stdio.h>
int main()
{
	char ans1, ans2;
	printf("每次课及时预习/复习了没? (是-输入y或Y, 否-输入n或N) :  ");
	ans1 = getchar(); 
	getchar(); 
	printf("\n动手敲代码实践了没? (是-输入y或Y, 否-输入n或N) :  ");
	ans2 = getchar();
	if ((ans1=='y'||ans1=='Y')&& (ans2=='y' || ans2=='Y')) 
		printf("\n罗马不是一天建成的, 继续保持哦:)\n");
	else
		printf("\n罗马不是一天毁灭的, 我们来建设吧\n");

	return 0;
}

  

  

image

 

image

image

image

实验任务4:

#include <stdio.h>
#include <math.h>
int main() 
{
    int year;
	year=round(1000000000/60/60/24/365);

    printf("10亿秒约等于%d年\n", year);
    return 0;
}

image

实验任务5:

#include <stdio.h>
int main() {
    double c, f;

    scanf("%lf", &c);

    f=c*9/5+32;
    
    printf("摄氏度c = %.2f时, 华氏温度f = %.2f\n\n", c, f);

    return 0;
}

  

image

image

 

image

实验任务6:

#include <stdio.h>
#include <math.h>
int main() {
    double a,b,c,s;
    scanf("%lf%lf%lf",&a,&b,&c);
    s=(a+b+c)/2;
	double m;
	m=sqrt(s*(s-a)*(s-b)*(s-c));
	printf("a=%lf b=%lf c=%lf 面积=%.3f\n",a,b,c,m);

    return 0;
}

  

image

 

image

 

posted @ 2026-10-16 15:21  虞清筱  阅读(8)  评论(1)    收藏  举报