已知三角形三边长a,b,c,求三角形的内切圆半径和外切圆半径。c语言编程
时间: 2024-05-10 17:21:41 浏览: 27
jiesanjiaoxing.rar_内切圆_外接圆_解三角形
```
#include <stdio.h>
#include <math.h>
int main()
{
float a, b, c, s, inr, outr;
printf("Enter the sides of the triangle: ");
scanf("%f %f %f", &a, &b, &c);
s = (a + b + c) / 2;
inr = sqrt((s - a) * (s - b) * (s - c) / s);
outr = a * b * c / (4 * sqrt(s * (s - a) * (s - b) * (s - c)));
printf("Inradius of the triangle is: %.2f\n", inr);
printf("Circumradius of the triangle is: %.2f\n", outr);
return 0;
}
```
阅读全文