Write a C function hwkl a, that takes a long int x as argument as well as two integers n and m, and returns a long int. Here is the function…