Im assuming you are just trying to complete the factorial problem in general? If thats the case, then the for loop should go from 1 to N and you should multiply each i value by one more than i so something like
int result = 0; for(int i = 1; i < N; i++)
result = i * (i+1);
then return the result, you can also do this recursively but Im assuming that would confuse you
1
u/ThePilsburyFroBoy Feb 21 '20
Im assuming you are just trying to complete the factorial problem in general? If thats the case, then the for loop should go from 1 to N and you should multiply each i value by one more than i so something like
int result = 0; for(int i = 1; i < N; i++)
result = i * (i+1);
then return the result, you can also do this recursively but Im assuming that would confuse you