Sorry for the inconvienience but i am expecting this pattern the pattern is in the attachment....i am just pasted my code and want alterations.... please help
but i am ending up wid something like
1
1 1
1 2 1
1 3 3 1
with the following code
[code=cpp]
#include <iostream.h>
void main()
{
int n,y,x,c;
cin >> n;
for (y = 0; y < n; y++)
{
c = 1;
for (x = 0; x <= y; x++)
{
cout<<" "<<c<< " ";
c = c * (y - x) / (x + 1);
}
cout<<endl;
}
cout<<endl;
}
[/code]
so please can someone help me out in spacing!
but i am ending up wid something like
1
1 1
1 2 1
1 3 3 1
with the following code
[code=cpp]
#include <iostream.h>
void main()
{
int n,y,x,c;
cin >> n;
for (y = 0; y < n; y++)
{
c = 1;
for (x = 0; x <= y; x++)
{
cout<<" "<<c<< " ";
c = c * (y - x) / (x + 1);
}
cout<<endl;
}
cout<<endl;
}
[/code]
so please can someone help me out in spacing!
Comment