6.判断三角形

来源:互联网 发布:java array 截取字数组 编辑:程序博客网 时间:2024/06/10 22:08
#include <stdlib.h>#include <stdio.h>int main(){    float   a;    float   b;    float   c;    float   temp;    //重新排列 a,b,c    if( a < b ){            temp = a;            a = b;            b = temp;    }    if( a < c ){            temp = a;            a = c;            c = temp;    }    if( b < c ){            temp = b;            b = c;            c = temp;    }    if( c <= 0 || b + c < a )         printf( "Not a triangle.\n" );    else if( a == b && b == c )        printf( "Equilateral.\n" );    else if( a == b || b == c )        printf( "Isosceles.\n" );    else        printf( "Scalene.\n" );    return EXIT_SUCCESS;}
0 0