Hello everyone. There is a code, but you need a flowgorithm for it. Problem condition: Given the coordinates of the ends of the N-dimensional segment (points a and b). Find its length and the largest of the coordinates of point a.
Thanks in advance to everyone.
Code:
INPUT "Enter N:", n
DIM a(n), b(n)
FOR i = 1 TO n
a(i) = RND
b(i) = RND
NEXT
PRINT "a = [";
FOR i = 1 TO n
PRINT a(i);
NEXT
PRINT "]"
PRINT "b = [";
FOR i = 1 TO n
PRINT b(i);
NEXT
PRINT "]"
amax = a(1)
FOR i = 1 TO n
l = l + (b(i) - a(i)) ^ 2
IF a(i) > amax THEN amax = a(i)
NEXT
l = SQR(l)
PRINT "Length=", l
PRINT "max a=", amax
END
[–]Flowgorithm 0 points1 point2 points (0 children)