I want the to calculate the value of user input by multiplying the number by it the increment i.e. if input is 5 then calculation should be 5*1*2*3*4=120, I have tried but so far not successful any help will be appreciated. The code is below:
import java.util.Scanner;
public class Math
{
public static void main(String[] args)
{
int op1, op2, Answer =0;
Scanner input;
input = new Scanner(System.in);
System.out.print("\nPlease enter the number: ");
op1 = input.nextInt();
{
for (int i = op1; i >= 1; i--)
{
Answer = (op1 * i (op1-1));
System.out.println(Answer);
}
}
}
}