package sateesh; import java.util.*; public class Factorial { int n; public Factorial(int m) { n=m; } public int fact(int x,int f) { for(x=1;x<=n;x++) { f=f*x; } return(f); } }Note: Do not run the package Program
import sateesh.Factorial; class Demo { public static void main(String args[]) { Factorial f=new Factorial(5); int pp=f.fact(1, 1); System.out.println(pp); } }
120