#include <iostream>
#include <iomanip>
using namespace std;
//#include <iomanip>
const int N = 6;
//use position and computer it's number
long computer(int n, int r)
{
long p = 1;
for(int i=1; i<=r; ++i)
p = p*(n-i+1) / i;
return p;
}
void print()
{
for(int n=0; n<=N; ++n)
{
for(int r=0; r<=n; ++r)
{
//print the blank
if(0 == r)
{
for(int i=0; i<=(N-n); ++i)
cout<<" ";
}
else
{
cout<<" ";
}
cout<<setw(3)<<computer(n,r);
}
cout<<endl;
}
}
int main()
{
print();
return 0;
}
#include <iomanip>
using namespace std;
//#include <iomanip>
const int N = 6;
//use position and computer it's number
long computer(int n, int r)
{
long p = 1;
for(int i=1; i<=r; ++i)
p = p*(n-i+1) / i;
return p;
}
void print()
{
for(int n=0; n<=N; ++n)
{
for(int r=0; r<=n; ++r)
{
//print the blank
if(0 == r)
{
for(int i=0; i<=(N-n); ++i)
cout<<" ";
}
else
{
cout<<" ";
}
cout<<setw(3)<<computer(n,r);
}
cout<<endl;
}
}
int main()
{
print();
return 0;
}