Question: Hello all, This code is written in C programming. I was looking for some help. I need to manipulate this script so it becomes a

Hello all,

This code is written in C programming. I was looking for some help.

I need to manipulate this script so it becomes a user defined function that does not take any argument and does not return any value.

#include #include

float S, trianglearea; float a[6],A,B,C; float triangle(float arr[]); main() { printf("What is the X coordinate of the first verticie? "); scanf("%f",&a[0]);

printf("What is the Y coordinate of the first verticie? "); scanf("%f",&a[1]);

printf("What is the X coordinate of the second verticie? "); scanf("%f",&a[2]);

printf("What is the Y coordinate of the second verticie? "); scanf("%f",&a[3]);

printf("What is the X coordinate of the third verticie? "); scanf("%f",&a[4]);

printf("What is the Y coordinate of the third verticie? "); scanf("%f",&a[5]);

triangle(a); printf("The area of a triangle with verticies (%5.2f, %5.2f),(%5.2f,%5.2f),(%5.2f,%5.2f), is %5.2f. ",a[0],a[1],a[2],a[3],a[4],a[5],trianglearea);

getchar(); return 0; }

float triangle (float a[]){ A=sqrt((a[0]-a[2])*(a[0]-a[2])+(a[1]-a[3])*(a[1]-a[3])); B=sqrt((a[0]-a[4])*(a[0]-a[4])+(a[1]-a[5])*(a[1]-a[5])); C=sqrt((a[2]-a[4])*(a[2]-a[4])+(a[3]-a[5])*(a[3]-a[5])); trianglearea=pow(S*(S-A)*(S-B)*(S-C),.5); return trianglearea; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!