Hi, Im new to java and I can not figure out where I am going wrong in this code. I need to take the value from the arguments in the run configuration. I the values are in args[] array and if there is more than one argument I need to print error, but I just am stuck on that part of the code. Here is what I have so far:
public class Numbers {
static int f(int n) {
int product = 1;
while (n > 0) {
product *= n;
n -= 1;
}
return product;
}
public static void main(String[] args) {
for (int i = 1; i <= 10; i++)
System.out.println(f(i));
}
}
Thank you for your time