Computer Science Homework Help

University of Montreal Pseudo Code of the MIPS Simple Program Project

 

Write a program containing two functions main and pow2. The main main function must call the pow2 function with the current parameter 10.

The pow2 function takes a single parameter, a positive integer, and calculates the value of the expression 2^x (pow2(x) = 2*x) recursively. The pseudo code to translate is given below.

Fonction pow2(exposant x):
if x < 1
return 1
ifnot
return 2*pow2(x – 1)

Fonction main()
print(pow2(10))
exit()