- **Java**
(*http://www.go4expert.com/forums/java/*)

- - **Java hw help**
(*http://www.go4expert.com/forums/java-hw-help-t25300/*)

Java hw helpHi, I'm new to Java and I have no idea how to do this problem. I don't know what loops are or how to use them.
5. In mathematics, exponentiation of an is a multiplied by itself n times. For instance, 53 is 5*5*5, or 125. Define a method so it may be called using the following statement and finds the correct exponential operation:int result = exponent(5,3); You must use a loop in your method. Using the java.lang.math method pow() is not allowed. You can assume that the exponent is a positive, whole number. Note that the ^ operator does not perform exponentiation. |

Re: Java hw helpyou can call the method what you want but I'm going to call it expo for now
public int expo(int n, int x){ int z, y; y=n; for(z=0: z<x; z++){ y=y*n; } return y; } is this correct? |

All times are GMT +5.5. The time now is 14:34. |