How can I find this equation ? Derived from where ?
x = x * (i -k) / (k +1)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
usingnamespace std;
int main()
{
int n, k, i, x;
cout << "Enter number of rows for Pascal's Triangle: ";
cin >> n;
for (i=0; i<=n ; i++) {
x=1;
for( k=0; k<=i; k++) {
cout << x << '\t';
x = x * (i -k) / (k +1); // How can I find this equation ?
}
cout << endl;
}
return 0;
}