Written the program to calculate K-cores