Distance between 2 points - multiple times

as part of my computer coursework, I ask the user to input the number of corners a fence will have (between 3 and 10) and ask them to input the co-ordinates. i then have to find the distance of each side. How do i do this? I know how to find the distance between 2 points but how do i get it to keep calculating the distance?