Write a java program to find the Difference between two Factorial Test Case 1 Input (stdin) 5 4 Expected Output The Difference is : 96 Test Case 2 Input (stdin) 0 Expected Output 0
import java.io.*;
import java.util.Scanner;
public class TestClass {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
long a=in.nextLong();
long b=in.nextLong();
int fact=1,fact1=1,d;
for(int i=1;i<=a;i++)
{
fact=fact*i;
}
for(int j=1;j<=b;j++)
{
fact1=fact1*j;
}
d=fact-fact1;
System.out.println("The Difference is : "+d);
}
}