博客
关于我
C语言-求三角形面积
阅读量:360 次
发布时间:2019-03-04

本文共 301 字,大约阅读时间需要 1 分钟。

一、代码

//三角形面积:(海伦公式)(p=(a+b+c)/2)//S=sqrt[p(p-a)(p-b)(p-c)]#include 
#include
void main(){ double a,b,c; double p; double s; scanf("%lf%lf%lf",&a,&b,&c); if((a+b>c)&&(a+c>b)&&(b+c>a)){ p=(a+b+c)/2; s=sqrt(p*(p-a)*(p-b)*(p-c)); printf("%lf",s); } else printf("无法构成三角形"); }

二、结果

转载地址:http://xbch.baihongyu.com/

你可能感兴趣的文章
nginx 开启ssl模块 [emerg] the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx
查看>>
Nginx 我们必须知道的那些事
查看>>
Nginx 源码完全注释(11)ngx_spinlock
查看>>
Nginx 的 proxy_pass 使用简介
查看>>
Nginx 的 SSL 模块安装
查看>>