Team-ClanX.org Forum Index Team-ClanX.org
Web Board for the ClanX Team
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    Return homeReturn Home 

Permutation Class ...

 
Post new topic   Reply to topic    Team-ClanX.org Forum Index -> Java
View previous topic :: View next topic  
Author Message
Opposite^Force
Super scripter


Joined: 12 Aug 2004
Posts: 172
Location: Turkey, Istanbul

PostPosted: Tue Nov 20, 2007 6:08 am    Post subject: Permutation Class ... Reply with quote

Code:

public class Permutation {

   public static int m;
      
   public static int f;
   
   public static int Factorial() {
      
      return 0;
   
   }
   
   public static int Factorial(int n) {
      
      if (n > 0) {
         
         int i = 1;
      
         f = 1;
         
         while (++i <= n) {
         
            f *= i;
         
         }
      
         m = f;
      
      }
      
      if (n == 0) { m = 1; }
      
      return m;
   
   }
   
   public static int Calc(int a, int b) {
   
      int n1, n2;
      
      if (a > b) {
      
         n1 = a;
      
         n2 = b;
      
      }   
         
      else {
         
         n1 = b;
         
         n2 = a;
      
      }
      
      return Factorial(n1) / Factorial(n1-n2);

   }

}

_________________
Opposite^Force
Team Clan X Scripter
Email: oscripts@aa-labs.com
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Team-ClanX.org Forum Index -> Java All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group