i am totally unable to think about how to get the sum of adjacent number from the previous row(basic idea of pascal triangle).
could you please give some “hint”!
Doubt in Pascal Triangle 1
could you please also provide solution (without using array)!
pls!!!
hey @shubham.mehla2000, in another method you should decide no of space in each line. I giving you logic for same.
space = 2*n-1;
for(i=0;i<n;i++)
{
for(j=0;j<space;j++)
cout<<" ";
space-=2;
for(j=0;j<=i;j++)
{
if(j==0||j==i)
cout<<"1 “;
else
cout<<i<<” ";
}
cout<<endl;
}
i have already done these type of question(like u sent) what i am unable to think of is main logic behind printing
the number to be shown on monitor in question of pascal!
i am not getting how to get sum of adjacent no. from previous row !