SDUT-1206 求三角形面积

来源:互联网 发布:数据库创建用户 编辑:程序博客网 时间:2024/06/14 03:37

求三角形面积

Time Limit: 1000MS Memory Limit: 65536KB
Submit Statistic Discuss

Problem Description

已知三角形的边长a、b和c,求其面积。

Input

输入三边a、b、c。

Output

输出面积,保留3位小数。

Example Input

1 2 2.5

Example Output

0.950

Code 

#include <stdio.h>#include <math.h>int main(){    double a,b,c,S,s;    scanf("%lf %lf %lf",&a,&b,&c);    s=0.5*(a+b+c);    S=sqrt(s*(s-a)*(s-b)*(s-c));    printf("%.3lf",S);    return 0;}
原创粉丝点击