hyqd.net
当前位置:首页 >> C语言编写直角三角形面积 >>

C语言编写直角三角形面积

好多错误,直接给你改正吧,你细细对照下看哪里错了:void main (){ float length1; float length2; float length3; float area; printf("请以此输入两个直角边长和斜边长\n");//scanf里面不要有'\n' scanf("%f%f%f",&length1,&length2,&

#include <stdio.h>#include <stdlib.h> int main() { float a=0.0,b=0.0,s=0.0; printf("输入三角形直角边a="); scanf("%f",&a); printf("输入三角形直角边b="); scanf("%f",&b); s=(a*b)/2;//计算三角形面积 printf("三角形面积s=%f\n",s); return 0; }

个数,只可能是底和高吧;/底和高 float Space; printf("please input Side and its Height;%f&quot,Height;/ Space = Side*Height/2; printf("the space is %; scanf("%f";);,&Height); void main() { float Side,&Side); scanf(",Space):\n&quot.2f\n&quot. #include

Then Somebody's dream had come true now./* 根据输入的三角形的三边,判断是否能组成三角形,若可以则输出它的面积和类型 (等腰,等边,直角,普通).按要求写程序.要求用简单的C语言写!!!*/#include<stdio.h>#include<math.h>

#include<stdio.h>int main(){ float a,b,c,t,s; printf("请输入3条边长:"); scanf("%f%f%f",&a,&b,&c); if(a>b){t=a;a=b;b=t;} if(b>c){t=b;b=c;c=t;} if(c>=a+b) { printf("不能构成三角形!\n"); return 0; } if(c*c==a*a+b*b) s=a*b/2; printf("直角三角形面积=%f\n",s); return 0;}

"stido.h"void main(){ int a,b,c; float sum=0.0 printf("输入直角三解形的两边:"); scanf("a=%d,b=%3d",&a,&b); printf("\n直角三角形的面积为:%f",sum(a,b));sum(int c ,int d){ sum=(1/2)*c*d;}

#include<stdio.h>#include<math.h> void main() { float a,b,c,s,area; scanf("%f,%f,%f",&a,&b,&c); s=1.0/2*(a+b+c); area=sqrt(s*(s-a)*(s-b)*(s-c)); printf("area=%7.2f\n",area); }

知道三边,利用海伦公式求面积.#include #include int main() { double a, b, c, p; scanf("%lf%lf%lf", &a, &b, &c); p = (a+b+c)/2; printf("%.3f", sqrt(p*(p-a)*(p-b)*(p-c))); //海伦公式,打印时%.3f保留小数点后三位 }

int a = 6;int b = 8;int c = a*b/2;cout>> c;

#include "stdio.h" void main() { int i,j; for(i=0;i<5;i++) { for(j=i;j>=0;j--) printf("* "); printf("\n\n"); } }

网站首页 | 网站地图
All rights reserved Powered by www.hyqd.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com