Can you check if my code and descriptions are correct?

Can you all please check if this goes according to the problem stated below, I'm new at this stuff and a friend of mine helped me, but whenever i put values to A1, A2,......I click enter and the screen closes and doesn't give me an answer.

__Also__ can you check if /*descriptions*/ i put are where they should.

-----------------------------------------------------------------------------------------------------------------

Suppose two men (say, A and B) walk away from the same location as follows.

Man A walks

A1 miles to east, then

A2 miles to north-east, then

A3 miles to east again and stops.

Man B walks

B1 miles south, then

B2 miles west, then

B3 miles south-west, and stops

We want to know the straight line distance between the two points where these men stopped. Solve the problem in terms of A1, A2, A3, B1, B2, B3 (user will enter values for these variables) and then write a program to compute the straight line distance between Man A and Man B.

Code:

`#include <stdio.h>`

#include <math.h>

#define MAX_STR_LEN 1024

int main (int argc, char *argvp[]) {

char line[MAX_STR_LEN];

/*Declaration of values Entered*/

int A1, A2, A3, B1, B2, B3;

double A2X, B3X, X, Y, ans;

do {

printf("\nEnter Distance for: A1,A2,A3,B1,B2,B3 : "); /*request information from user*/

fgets(line,MAX_STR_LEN,stdin); /*read input from user*/

} while (sscanf(line, "%d ,%d ,%d ,%d ,%d ,%d",

&A1,&A2,&A3,&B1,&B2,&B3) != 6);

/*Perform Calculation*/

A2X = sqrt(pow((double)A2,2)/2);

B3X = sqrt(pow((double)B3,2)/2);

X = A1 + A3 + B2 + A2X + B3X;

Y = A2X + B3X;

X = pow(X, 2);

Y = pow(Y, 2);

ans = sqrt(X + Y);

printf("\nThe Distance is: %g\n", ans);

/*Exit Program*/

return 0;

}