You need to have a variable for the iterator
class Class1
{
public int userInput(int user_Input)
{
int final_Value = 1;
for ( int i = 1; int <= user_Input; i++)
final_Value *= i; // equal to : final_Value = final_Value * i;
return final_Value;
}
}
final_Value
will initially be 1
then will be multiplied by i
for each increment.