C语言试编写一个计算三角形面积的程序
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/14 00:35:35
如果是pascal和VB我知道怎么做但c语言我不会,这里就讲一下思路首先输入三个数(定位为实数),然后判断a+b>c且a+c>b且b+c>a,成立的话进行计算p=(a+b+c)/2s=sqrt(平方根
#includedoublecalRectArea(doubledWidth,doubledHeigh){returndWidth*dHeigh;}voidmain(){doublea,b,mul;s
//别说100位,1000位都没问题,给你个例子.#include#definePRECISION2800#defineFRACTION1000#defineGROUP4#defineINITIALV
给,已经编译运行确认:#include#include#includeintmain(){floata,b,c;floatarea,s;printf("请输入三角行的三边:");scanf("%f%f
输入三角形三边长,求三角形面积.#include“math.h”main(){floata,b,c,s,area;scanf(“%f,%f,%f”,&a,&b,&c);s=1.0/2*(a+b+c);
intarea(intx,inty){returnx*y;}intgri(intx,inty){return2*(x+y);}
#include#includeintmain(){floats,a,b,c,p;printf("请输入三角形的三边,以空格隔开");scanf("%f%f%f",&a,&b,&c);if(a+b>c
#include <stdio.h>#include <math.h>//double sin(double x);#define&nb
#include <stdio.h>float area(float r){ return 3.14159 *&nb
#includeintgetArea(intlen){\x09returnlen*len;}intmain(){\x09intn;\x09intarea;\x09\x09printf("请输入边长:\
#include#includemain(){inta,b,c,flag;floatarea,s;printf("inputsideoftriangle:");scanf("%d%d%d",&a,&b
.就知道一个周长,怎么求面积啊?N种可能啊满意请采纳
#includevoidmain(){doubler,s,l;printf("请输入圆的半径\n");scanf("%lf",&r);s=3.14159*r*r;l=2*3.14159*r;print
#include <stdio.h>int main(){ float x, tax = 0;
假设知道三角形的三边长为a,b,c.程序如下:#include#includedoublearea(doublea,doubleb,doublec){doublearea=0,s=0;s=(a+b+c
#include#defineN9voidmain(){inti,j,a[N][N]={0};for(i=1;i
voidjudge(inta,intb,intc)//判断三角形{if(a+b>c&&b+c>a&&a+c>b)elseif(a==b||b==c||a==c){if(a==b==c)printf("
//使用海伦公式#include/*ForIO*/#include/*Forsqrt()*/intmain(void){doublea,b,c,p,s;printf("请输入a,b和c:");scan
两个数,只可能是底和高吧.#includevoidmain(){floatSide,Height;//底和高floatSpace;printf("pleaseinputSideanditsHeight
m=2a+2b;应该改成m=2*a+2*b;程序中2a,2b是不允许的,没有意义的.