Texts: Systematically calculate the multiplicative inverse. Implement the following multiplicative inverse algorithm (it means create the code in any programming language that you are familiar with):
Submit the following:
1. The program code you implemented.
2. A file readme containing the following:
- An example input numbers and expected outputs.
- A detailed description of the way you used your program to find out the multiplicative inverse. This includes detailed instructions for compiling and executing the programs.
The program will be tested according to your instructions to produce the expected outputs.
Input: two positive integers b and a.
Output: the inverse of a modulo b, a^-1 mod b, if it exists.
Step 1: While s > 0 do
Step 1.1: temp = r - q * s.
Step 1.2: If temp < 0 then temp = temp mod b.
Step 1.2.1: Else temp = b - ((-temp) mod b).
Step 1.3: r = s.
Step 1.4: s = temp.
Step 1.5: bo = ao.
Step 1.6: ao = s.
Step 1.7: q = [n].
Step 1.8: s = bo - q * ao.
Step 2: End While
Step 3: If ao ≠ 1 then output a has no inverse modulo b.
Step 3.1: Else return a^-1 = r mod b.