Hi guys. Hope you are well. I'm particularly stuck on understanding for loops properly. I have this program which computes numbers to whatever power you want it to. There are two command line arguments, the first being the number and the second being the power:
Can anyone help on correcting this problem and possibly explaining how the for loop works, because i'm so confused :SCode:
public class Power
{
public static void main(String [] args)
{
int number = Integer.parseInt(args[0]);
int power = Integer.parseInt(args[1]);
int answer = 0;
for (int i = 0; i*i < power; i++)
answer=number*power;
System.out.println(answer);
}
}
Kind regards
Shyam
