I'm trying to write a function :void permutations(int m,int n) to print all the permutations of the numbers 1,...,m per n.For example , permutations(4,2) should print:

(1,2)

(1,3)

(1,4)

(2,1)

(2,3)

(2,4)

(3,1)

(3,2)

(3,4)

(4,1)

(4,2)

(4,3)

I've tried many things with no results.Can you help me?

Recursive and non-recursive functions are both acceptable.