+ 1
What's happening here
7 odpowiedzi
+ 6
Result is assumed to be 1 so initially when you do:
result*=x
You get the number you passed earlier in the method as first argument so that result is equal to x.
result*=x ===> x result = x
Then the for loop multiply that number with itself doing:
result*=x ===> x*x result = x*x
result*=x ===> x*x*x result = x*x*x
...
+ 5
There is a method called "Pow" which takes two arguments, a base and eventually an exponent (of none is given, 2 is assumed to be the exponent)
The main method just checks the method and the output is the result of:
6^2=36
3^4=81
0
But in the code we mentioned result*=x;
0
For which I think the result should be 1*6 = 6
0
Ok, thank u
0
Hi
0
Hello