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 {

 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(;
  for(int i=fac;i>0;i--){
   num *= i; 
  System.out.print("The factorial of the input number is: "+num );