C program to find inverses of a permutation

Hi all,

I'm kind of newbie to these programming stuff. Can you please help me out with a code to find inverses of a permutation?

For example, if the elements are 10 4 12 11 6, to find inverse, we have to compare first element with the subsequent elements, if the first element is larger than the compared element, then it is an inverse..

to start: compare 10 to 4, Condition 1: the position of 10 is < 4, so now compare the value 10>4, so it is an inverse.. NExt compare, 10 with 12, similarly position of 10 is less than 12, now compare values 10<12, it is not inverse... so on..

then compare 4 with all its subsequent elements. Similarly compare all the elemeents with *subsequent* elements alone and increment count if value of 1st elemnt> element compared..