<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GeeksPlanet.net &#187; Pascals triangle</title>
	<atom:link href="http://geeksplanet.net/tag/pascals-triangle/feed/" rel="self" type="application/rss+xml" />
	<link>http://geeksplanet.net</link>
	<description>C, C++, JAVA, PERL programming for Dummies</description>
	<lastBuildDate>Wed, 24 Feb 2010 11:38:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A C++ program to generate a Pascal’s triangle</title>
		<link>http://geeksplanet.net/2008/10/cpp/a-c-program-to-generate-a-pascal%e2%80%99s-triangle/</link>
		<comments>http://geeksplanet.net/2008/10/cpp/a-c-program-to-generate-a-pascal%e2%80%99s-triangle/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 10:49:38 +0000</pubDate>
		<dc:creator>Satish Gandham</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Pascals triangle]]></category>

		<guid isPermaLink="false">http://geeksplanet.net/?p=17</guid>
		<description><![CDATA[A C++ program to generate a Pascal’s triangle which is as follows: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 Download the program Pascals-Triangle]]></description>
			<content:encoded><![CDATA[<p>A <strong>C++ program</strong> to generate a <strong>Pascal’s triangle</strong> which is as follows:</p>
<pre>
      1
     1 1
    1 2 1
   1 3 3 1
  1 4 6 4 1</pre>
<pre class="brush: cpp; title: ; notranslate">
&lt;pre&gt;#include&lt;iostream&gt;
using namespace std;
int fact(int);
main()
{
	int rows,i,j,k;
	cout&lt;&lt;&quot;Enter the numbe of rows you want in the triangle:&quot;;
	cin&gt;&gt;rows;
	for(i=0;i&lt;rows;i++)
	{
		//Moving each row by rows-i spaces to get a triangular shape
		for(k=0;k&lt;(rows-i);k++)
		cout&lt;&lt;&quot; &quot;;
		//Loop for printing each row
		for(j=0;j&lt;=i;j++)
		cout&lt;&lt;&quot; &quot;&lt;&lt;fact(i)/(fact(j)*fact(i-j)); //nCr=n!/(r!*(n-r)!)
		cout&lt;&lt;endl;
	}
}

int fact(int i)
{
	int value=1;
	while(i!=0)
	{
		value=value*i;
		i--;
	}
	return value;
}&lt;/pre&gt;
</pre>
<blockquote>
<h2><a href="http://geeksplanet.net/wp-content/uploads/2008/10/pascal-triangle.cpp">Download the program Pascals-Triangle</a></h2>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://geeksplanet.net/2008/10/cpp/a-c-program-to-generate-a-pascal%e2%80%99s-triangle/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

