### 题目描述

#include <stdio.h>
#define swap(x,y){x=x+y;y=x-y;x=x-y;}
/*下面三个函数都是：是返回1，不是返回0*/
int right_triangle(double a,double b,double c); /*判断直角三角形*/
int acute_triangle(double a,double b,double c); /*判断锐角三角形*/
int obtuse_triangle(double a,double b,double c); /*判断钝角三角形*/
int main()
{
double a,b,c;   /*三角形的三边*/
scanf("%lf %lf %lf",&a,&b,&c);  /*输入三边*/
/*将三边按照从小到大排好*/
if(a>b)
swap(a,b);
if(a>c)
swap(a,c);
if(b>c)
swap(b,c);
/*根据if判断选择三角形*/
if(acute_triangle(a,b,c))
printf("锐角三角形\n");
else if(right_triangle(a,b,c))
printf("直角三角形\n");
else if(obtuse_triangle(a,b,c))
printf("钝角三角形\n");
return 0;
}

3 4 5

### 代码如下

``````
#include <stdio.h>
#define swap(x,y){x=x+y;y=x-y;x=x-y;}
/*下面三个函数都是：是返回1，不是返回0*/
int right_triangle(double a,double b,double c); /*判断直角三角形*/
int acute_triangle(double a,double b,double c); /*判断锐角三角形*/
int obtuse_triangle(double a,double b,double c); /*判断钝角三角形*/
int main()
{
double a,b,c;   /*三角形的三边*/
scanf("%lf %lf %lf",&a,&b,&c);  /*输入三边*/
/*将三边按照从小到大排好*/
if(a>b)
swap(a,b);
if(a>c)
swap(a,c);
if(b>c)
swap(b,c);
/*根据if判断选择三角形*/
if(acute_triangle(a,b,c))
printf("锐角三角形\n");
else if(right_triangle(a,b,c))
printf("直角三角形\n");
else if(obtuse_triangle(a,b,c))
printf("钝角三角形\n");
return 0;
}
#include<math.h>
int right_triangle(double a,double b,double c){
if(fabs(c*c-b*b-a*a)<0.0001)return 1;
else return 0;
}
int acute_triangle(double a,double b,double c){
if((c*c-b*b-a*a)<0)return 1;
else return 0;
}
int obtuse_triangle(double a,double b,double c){
if((c*c-b*b-a*a)>0)return 1;
else return 0;
}``````