Question: I'm having trouble in my code, I created two function called function and secondfunction I called both functions in the main function. However, the only

I'm having trouble in my code, I created two function called "function" and "secondfunction" I called both functions in the main function. However, the only function it will read it the first function written first in this case its's "function." How can I make the main function call the "secondfunction" as well?

#include /*Include library*/

int function(void); int secondfunction(void);

int main(void) { printf("Enter three points back to back like this: (1,2) enter it like 1 2. ");/*Output*/

function();/*Calling function in the main function*/ secondfunction();/*Calling function in the main fucntion*/

return 1;/*Return exit value*/ } int function(void)/*New function*/ { int a, b, c, d, e, f;/*Initialize variables*/ int area;/*Intialize variables*/ scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);/*Store public value for 6 integers*/ area = ((0.5) * abs((a * (d - b)) + (c * (f - b)) + (e * (b - d))));/*Area formula, abs used as absolute value brackets*/ printf("Triangle points: (%d,%d), (%d,%d), and (%d,%d) ", a, b, c, d, e, f);/*Ouptut of the points*/ printf("Area = %d", area);/*Ouput area computed from the area formula*/ return 1;/*Return exit value*/ } int secondfunction(void)/*New function*/ { int a, b, c, d, e, f;/*Intialize variables*/ double side;/*Type double*/ double perimeter;/*Type double*/ scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);/*Store public value for 6 integers*/ side = sqrt((c - a) * (c - a) + (d - b) * (d - b));/*Side formula*/ perimeter = (side + side + side);/*Perimeter formula, side added three times*/ printf("Perimeter = %f", perimeter);/*Output the perimeter computed from the perimeter formula*/ return 1;/* Return exit value*/ }

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!