CJCoding With Joseph
15free / daySign inCreate account

Distance Between Two Points

A Point struct (int x, y) is defined. Read two points (four integers: x1 y1 x2 y2). Print the Manhattan distance between them: the sum of the absolute differences of the x and y values.

Example: points (1, 2) and (4, 6) give |4-1| + |6-2| = 3 + 4 = 7.

Expected Output:

7

= newline. No newline after the last line.

Hints4 available
Topics:
Structs
📥 Auto-Input:
1 2 4 6\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.