Hi.
If its a mathematical inverse u are tryin, then this would be the code of the function..
int inverse(number_from_main)
{
int inverse; // can also be float
inverse = 1 / number_from_main ;
return inverse;
}
5 Description of the Algorithm
Algorithm 5.1: Gauss-Jordan Method (B 2 <n×n)
comment: Create an Augmented Matrix
A = [B I]
for i = 1 to n
8>
>>>>>>>>>>>>>>>>>>>>>>>>>>><>>>>>>>>>>>>>>>>>>>>>> >>>>>>:
comment: Find the pivot
pivot aii
if pivot < 10−8
then
8>
>><>>>:
Matrix is singular
det 0
Return
comment: Perform Row Elimination
comment: Normalise the row by dividing each element by the pivot
for j = 1 to 2n
aij = aij/pivot
for k = 1 to n
8>
>>>>>><>>>>>>>:
if k 6= i
then
8>
>><>>>:
m aki
for j = 1 to 2n
akj = akj − m × aij
for i = 1 to n
8>
<>
:
for j = 1 to n
B−1[i, j] = A[i, j + n]
output (B−1)