三角形内切圆的面积
题目描述:
给出三角形三边的边长,求此三角形内切圆(如下图所示,三角形的内切圆是和三角形三边都相切的圆)的面积。
输入:
三个正实数a、b、c(满足a+b>c,b+c>a,c+a>b), 表示三角形三边的边长。
输出:
三角形内切圆的面积,结果四舍五入到小数点后面2位。
输入样例:
3 4 5
输出样例:
3.14
程序:
#include <stdio.h>
#include <math.h>
int main( ){
float a, b, c, r, s, t;
scanf("%f %f %f", &a, &b, &c);
s = ( __(1)__ ) / 2;
t = __(2)__ (s * (s - a) * (s - b) * (s - c));
r = t / s;
printf(" __(3)__ \n", 3.1415927 * r * __(4)__ );
return 0;
}
(1):_________
(2):_________
(3):_________
(4):_________
答案:
(1):a+b+c_
(2):sqrt
(3):____%.2f____
(4):r_
#include <stdio.h>
#include <math.h>
int main( ){
float a, b, c, r, s, t;
scanf("%f %f %f", &a, &b, &c);
s = (a+b+c) / 2;
t = sqrt (s * (s - a) * (s - b) * (s - c));
r = t / s;
printf(" %.2f \n", 3.1415927 * r * r );
return 0;
}