Write C function hwk1a, 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 declaration:…