实验1-实验任务7-8

 
实验任务7
1
#include <stdio.h> 2 #include <math.h> 3 int main() 4 { 5 double C, F; 6 while (scanf_s("%lf", &C) != EOF) 7 { 8 F = C * 9 / 5 + 32; 9 printf("摄氏度C=%.2f时,华氏度F=%.2f", C, F); 10 printf("\n"); 11 } 12 return 0; 13 14 }

 

实验任务8

#include <stdio.h>
#include <math.h>
int main()
{
int a, b, c;
while (scanf_s("%d%d%d", &a, &b, &c) != EOF)
{
double area, s;
s = (a + b + c) * 1.0 / 2;
area = sqrt(s * (s - a) * (s - b) * (s - c));
printf("a=%d,b=%d,c=%d,area=%.3f", a, b, c, area);
printf("\n");
}
return 0;
}

 

posted @ 2023-10-29 21:18  铭懿  阅读(19)  评论(0)    收藏  举报