#K79772. Slope Calculator
Slope Calculator
Slope Calculator
You are given the coordinates of two distinct points in the plane: ( (x_1, y_1) ) and ( (x_2, y_2) ). Your task is to compute the slope ( m ) of the line that connects these two points using the formula:
[
m = \frac{y_2 - y_1}{x_2 - x_1}
]
If the line is vertical (i.e. when ( x_1 = x_2 )), the slope is undefined and you should output the string undefined
.
inputFormat
Input is provided through standard input (stdin) as a single line containing four space-separated numbers: ( x_1, y_1, x_2, y_2 ).
outputFormat
Output to standard output (stdout) the slope of the line. If the slope is defined, print a floating-point number accurate to one decimal place. If the slope is undefined because the line is vertical, print the string undefined
.## sample
1 2 3 4
1.0