current position:Home>Why do you report an error? Find a solution

Why do you report an error? Find a solution

2022-02-02 23:23:45 CSDN Q & A

double area(double x,double y,double z);
double p=(x+y+z)/2;
return sqrt(p*(p-x)(p-y)(p-z));
int main()
double a1,a2,a3,a4,a5,a6,a7,s;
printf("input 7 sise lengths in the order a1 to a7:\n");
printf("the area of the pentagon is:%.2f\n",s);
return 0;

Refer to the answer 1:

double area(double x,double y,double z);
Delete the semicolon after it
In addition, in the function, you should check whether the length of three sides can form a triangle , otherwise sqrt The parameter of may be a negative number , Something's going to go wrong

Refer to the answer 2:

Refer to the answer 3:

a6 Ahead , and & It's written backwards

Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.

Random recommended