PROGRAM
// Program to print Pascal triangle
# include <iostream>
using namespace std;
int main()
{
int i,j,k=0,m=1,rows;
cout<<"ENTER THE NUMBER OF ROWS:\n";
cin>>rows;
cout<<"\nOUTPUT:\n";
for(i=0 ; i<=rows ; i++)
{
for(m=(rows-i) ; m>0 ; m--)
cout<<" ";
for(j=0;j<=i;j++)
{
if(i==0||j==0)
m=1;
else
m=m*(i-j+1)/j;
cout<<" "<<m;
}
cout<<endl;
}
return 0;
}
OUTPUT
// Program to print Pascal triangle
# include <iostream>
using namespace std;
int main()
{
int i,j,k=0,m=1,rows;
cout<<"ENTER THE NUMBER OF ROWS:\n";
cin>>rows;
cout<<"\nOUTPUT:\n";
for(i=0 ; i<=rows ; i++)
{
for(m=(rows-i) ; m>0 ; m--)
cout<<" ";
for(j=0;j<=i;j++)
{
if(i==0||j==0)
m=1;
else
m=m*(i-j+1)/j;
cout<<" "<<m;
}
cout<<endl;
}
return 0;
}
OUTPUT