CJCoding With Joseph

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
Topics:
Structs
๐Ÿ“ฅ Auto-Input:
1 2 4 6\n
This input is automatically fed to your program's stdin
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.