📅  最后修改于: 2022-03-11 14:44:54.394000             🧑  作者: Mango
#include
using namespace std;
int fact(int num){
int factorial = 1;
for (int i = 2; i <= num; i++)
{
factorial = factorial * i;
}
return factorial;
}
int main(){
int n;
cout << "Enter number of rows: ";
cin >> n;
for (int i = 0; i < n; i++)
{
for (int j = 0; j <=i; j++)
{
cout << fact(i) / (fact(j) * fact(i - j)) << " ";
}
cout << endl;
}
}