Home>

I'm actually working on the following content, but I couldn't display it well. Also, it would be helpful if you could check that it was written according to the content.
If four real numbers x1, x2, y1 and y2 representing two points (x1, x2) and (y1, y2) in two-dimensional space are entered in this order, the square of the Euclidean distance between these two points (x1 −) Create a program that outputs y1) ^ 2 + (x2 − y2) ^ 2, and show the code and a screenshot of the execution example. However, define and use the function fun. Here, the function fun shall return x1 ^ 2 + x2 ^ 2 given the two real numbers x1 and x2 in that order. Also, it is assumed that the arguments and return types of the function fun are all double types.

#include<stdio.h>
/ * Definition of fun function * /
double fun (double x1, double x2, double y1, double y2)
{
    double z;
    z = (x1-y1) (x1-y1) + (x2-y2) (x2--y2);
    return z;
}
int main (void)
{
    double num1, num2, num3, num4, ans;
    printf ("Enter the x coordinate at the first point in 2D space. \ N");
    scanf ("% lf",&num1);
    printf ("Enter the y coordinate at the first point in 2D space. \ N");
    scanf ("% lf",&num2);
    printf ("Enter the x coordinate at the second point in 2D space. \ N");
    scanf ("% lf",&num3);
    printf ("Enter the x coordinate at the second point in 2D space. \ N");
    scanf ("% lf",&num4);
    ans = fun (num1, num2, num3, num4);
    printf ("The square of the Euclidean distance between two points is% lf.", ans);
    return 0;
}

The details of the error that occurred are as follows.
Severity level Code Description Project file line suppression status
Error C2064 347 Not evaluated for functions that take arguments. Project4 C: \ Users \ nishi \ source \ repos \ Project4 \ Project4 \ Sample1.c 8
Error (active) E0109 The expression before the parentheses in the call must be of type (or pointer-to-function) Project4 C: \ Users \ nishi \ source \ repos \ Project4 \ Project4 \ Sample1.c 8
Error (active) E0109 The expression before the parentheses in the call must be of type (or pointer-to-function) Project4 C: \ Users \ nishi \ source \ repos \ Project4 \ Project4 \ Sample1.c 8
Warning C6031 Return value ignored:'scanf' Project4 C: \ Users \ nishi \ source \ repos \ Project4 \ Project4 \ Sample1.c 10
Error C2064 347 Not evaluated for functions that take arguments. Project4 C: \ Users \ nishi \ source \ repos \ Project4 \ Project4 \ Sample1.c 8