k_means clustering algorithm

i just find an k_means clustering algorithm online(it is not my work actually). The reason i choose k_means type of the clustering algorithm will put on another file later. And i am not sure that my choice is right, so i just post it here and u guys can see it and figure out the right answer.