Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Combinatorial Elements(without condition :x>=k)
Language: C/C++
Code:
#include <iostream>
#include <conio.h>
using namespace std;
 unsigned __int64 factorial(int n)
      {if(n==0) return 1;
       else return factorial(n-1)*n;}
 
    int  main()
      { unsigned __int64  x,k;
std::cout<<"Please enter the first number :"<<""<<endl;
std::cout<<"x=";std::cin>>x;
std::cout<<"Please enter the second number :"<<""<<endl;
std::cout<<"k=";std::cin>>k;
std::cout<<"The factorial of x is:";
std::cout<<factorial(x)<<endl;
std::cout<<"The factorial of k is:";
std::cout<<factorial(k)<<endl;
 std::cout<<"Arranjaments of x taken by k  :"<<"";
std::cout<<factorial(x)/factorial(x-k)<<endl;
 std::cout<<"Combinations of x taken by k  :"<<"";
std::cout<<factorial(x)/(factorial(k)*factorial(x-k));
             getch();
}     
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
Comments: