Factorial Series

Factorial Series...
public class Factorial{
 public void printFactorials(int min,int max)
 {
  for(int i=min;i<=max;i++)
  {
   System.out.println("Fact: "+fact(i));
  }
 }

 public int fact(int n)
 {
  if(n<=1)
   return 1;
  return n*fact(n-1);
 }
}

Reactions

Post a Comment

0 Comments