Logo

Prove that the following recursive algorithm to compute \(a^n\) , is correct using mathematical induction. int power(int a, int n) { if (n == 0)…

bitm Discrete Structure · 2023 · Solved Question with Answer

Prove that the following recursive algorithm to compute \(a^n\), is correct using mathematical induction.

int power(int a, int n)
{ if (n == 0) return 1;
  else return a * power (a, n - 1);}
Solution

Please login to view the answer.