~cpp
#include <stdio.h>
int factorial(int n);
int permutation(int n, int r);
int combination(int n,int r);
int main(int argc, char* argv[])
{
int col,row;
printf("행 : "); scanf("%d",&row);
printf("열 : "); scanf("%d",&col);
printf("result = %d\n",combination(row-1,col-1));
return 0;
}
int factorial(int n)
{
if(n==1 || n==0) return 1;
return n*factorial(n-1);
}
int permutation(int n, int r)
{
return factorial(n)/factorial(n-r);
}
int combination(int n,int r)
{
if(r==0) return 1;
return permutation(n,r)/factorial(r);
}