Problem 1: Develop a C program that defines two functions, one to compute the ar
ID: 3005919 • Letter: P
Question
Problem 1:
Develop a C program that defines two functions, one to compute the area of a triangle, the other function to compute the circumference of a triangle. The program must include the function prototypes and call these functions from main.
You should ask user for input and display the resuls.
Problem 2:
Develop a computational model (with a C program) that computes the slope of a line between two points in a plane: P1 with coordinates (x1 , y1 ), and P2 with coordinates (x2,y2). The program should include two functions: main and slopef. The parameters of the second function (slopef) are the coordinates of the points in a plane. Use the coordinate values: (0,3/2) and (2,0).
You should ask user for input and display the results.
Explanation / Answer
1)
float area(float a, float b, float c)
{
float s, area;
s = (a+b+c)/2;
area = sqrt(s*(s-a)*(s-b)*(s-c));
return area;
}
float circum(float a, float b, float c)
{
float c;
c = (a+b+c)
return c;
}
int main(){
float a,b,c;
float Area, Circum;
printf("Enter size of each sides of triangle");
scanf("%f%f%f",&a,&b,&c);
Area=area(a,b,c);
Circum=circum(a,,b,c);
printf("Area of triangle is: %f," Area);
printf("Circumf of triangle is: %f," Circum);
}