#include <iostream.h>
#include <math.h>
void constructPascal(int numRows);
int main(void)
{
int numRows;
cout <<"Enter the number of rows of the Pascal Triangle: ";
cin >> numRows;
constructPascal(numRows);
return 0;
}
void constructPascal(int numRows)
{
int n,k;
int simple[23][23] = {1};
for(n=1; n<=(numRows-1); n++)
{
for(k=1; k<=(numRows-1); k++)
{
simple[n][k]=simple[n-1][k-1]+simple[n-1][k];
cout << "\t"<<simple[n][k];
}
cout <<"\n";
}
}
#include <math.h>
void constructPascal(int numRows);
int main(void)
{
int numRows;
cout <<"Enter the number of rows of the Pascal Triangle: ";
cin >> numRows;
constructPascal(numRows);
return 0;
}
void constructPascal(int numRows)
{
int n,k;
int simple[23][23] = {1};
for(n=1; n<=(numRows-1); n++)
{
for(k=1; k<=(numRows-1); k++)
{
simple[n][k]=simple[n-1][k-1]+simple[n-1][k];
cout << "\t"<<simple[n][k];
}
cout <<"\n";
}
}