Java Programming Exercise : Find the fatorial of a number using for loop

Let's see the code and think how it works together. :)

import java.util.Scanner;

public class FactorialCalcualtion {

 /**
  * YaSolution.org
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  int fac=1;
  int num=1;
  
  System.out.print("Input a number: ");
  Scanner mysc = new Scanner(System.in);
  fac=mysc.nextInt();
  for(int i=fac;i>0;i--){
   num *= i; 
  }
  
  System.out.print("The factorial of the input number is: "+num );
 }

}