Write a program using recursion which should take two values and display 1st value raised to the power of second value.
Read the part in your programming manual/text book about recursion. The short answer while easy does not tell you anything about the power or dangers of recursion. It is the power and dangers of recursion that is important because once understood you can use recursion to good effect without running out of stack space.
// Returns ab public static final int pow(final int a, final int b) { if (b 0) { return 1; } return a * pow(a, b - 1); }
x raised to the power 36 is x36. Without a value for x, there is nothing to solve!
//with a function: int exponent(int a, int b){ int returnValue; if (x==0) return 1; else return(a*exponent(a,x-1)); } main(){ printf("%d\n", exponent(1, 1)); }
R4S8, and there is nothing further that can be done without more information.
Recursion is dangerous yet powerful tool. It is dangerous because it can lead to bad programs in terms of time and space when not used properly. Recursion is needed in implementing very good graph related algorithms such as graph traversal. Recursion shows it's real power for the problems which have underlying concept of stack.Stack can be best implemented using only with recursion.
A^8 or A raised to the power of 8.
11 raised to the 9th power divided by 9 raised to the 90th power
It can be raised to any power.It can be raised to any power.It can be raised to any power.It can be raised to any power.
It is 10x raised to the second power.
113 raised to the power of 9 minus 189 raised to the power of 6 equals 3.0039964e+18