Hi guys. Ive created a program that computes powers when typed in as command line arguments. I have the following code, but i cannot understand why the IF statement doesnt make the result 0 is a power 0 is typed in as a command line argument:
int mantissa = Integer.parseInt(args[0]);
int exponent = Integer.parseInt(args[1]);
int answer = mantissa;
for(int i=1; i < exponent; i++)
answer=answer*mantissa;
if (args[1] == 0)
answer = 1;
regards
Shyam