파스칼,.

~cpp 
#include <iostream>
using namespace std;

int pas(int aCol, int aRow);

void main()
{
	int row, col, res;
	cout<<"행과 열을 입력 : ";
	cin >> row >> col;
	res = pas(col, row);
	cout << res << endl;
}

int pas(int aCol, int aRow)
{
	if(aCol == 1 || aCol == aRow)
		return 1;
	else 
		return pas(aCol - 1, aRow - 1) + pas(aRow,  aCol - 1);
}


댓글

  • 3행 2열은 값이 안나오는데요?... -지훈
Retrieved from http://wiki.zeropage.org/wiki.php/파스칼삼각형/문원명
last modified 2021-02-07 05:31:23