Jump to content

Catalan numbers/Pascal's triangle: Difference between revisions

Add Scilab section
(Add Scilab section)
Line 593:
<pre>
1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845
</pre>
 
=={{header|Scilab}}==
<lang>
n=15
t=zeros(1,n+2)
t(1)=1
for i=1:n
for j=i+1:-1:2
t(j)=t(j)+t(j-1)
end
t(i+1)=t(i)
for j=i+2:-1:2
t(j)=t(j)+t(j-1)
end
disp(t(i+1)-t(i))
end
</lang>
{{out}}
<pre style="height:20ex">
1.
2.
5.
14.
42.
132.
429.
1430.
4862.
16796.
58786.
208012.
742900.
2674440.
9694845.
</pre>
 
1,392

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.