The formula for solving the combinatorial number is C .... The programming input m,n, the output combination number, the request uses the custom function realization to seek the factorial __php

Source: Internet
Author: User
 
/* Experimental content: Combinatorial number solution formula is C .... Programming input m,n, output combination number, required to use a custom function to achieve factorial

 * Yantai University Computer College Class 114-3 students

 * Author: Liu Yang

 * Time: March 4, 2012

 * (2-1) The formula for solving the combinatorial number is C ... The programming input m,n, the output combination number, the request uses the custom function implementation to seek the factorial.

 * Algorithm Description: */

#include <iostream>
using namespace std;
Long FAC (int n)
{
	long  double S=1;
	while (n>0)
	{
		s=s*n;
		--n;
	}
	return s;
}
int main ()
{
	int m,n,t;
	a long double a,b,c;
	cout<< "Please enter the value of M:";
	cin>>m;
	cout<<endl;
	cout<< "Please enter the value of N:";
	cin>>n;
	if (n!=0&&m>=n)
	{
		A=FAC (m);
		B=FAC (n);
		C=FAC (m-n);
		t=a/(b*c);
		cout<< "Combined number result:" <<t<<endl;
	}
	else 
		cout<< "No results" <<endl;
	return 0;

}

Operation Result:
 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.