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;
点击查看代码
#include<stdio.h>
int main() {
printf(" O O\n");
printf("<H> <H>\n");
printf("I I I I\n");
return 0;
}
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;
}
task3
点击查看代码
![](/i/l/?n=24&i=blog/3405472/202403/3405472-20240316104808756-1778003700.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;
}
task5
点击查看代码
#include <stdio.h>
int main()
{
int year;
year = 1000000000 / (3600 * 24 * 365);
printf("10亿秒约等于%d年\n", year);
return 0;
}
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;
}
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;
}
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;
}