<?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>PHP Tutorials By Kloplop321 &#187; command line</title>
	<atom:link href="http://kloplop321.com/php-tutorials/index.php/tag/command-line/feed/" rel="self" type="application/rss+xml" />
	<link>http://kloplop321.com/php-tutorials</link>
	<description>PHP video tutorials, for everyone.</description>
	<lastBuildDate>Sun, 20 Mar 2011 19:03:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>PHP Programming Competition Problem 01</title>
		<link>http://kloplop321.com/php-tutorials/index.php/2010/02/15/php-programming-competition-problem-01/</link>
		<comments>http://kloplop321.com/php-tutorials/index.php/2010/02/15/php-programming-competition-problem-01/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 15:55:34 +0000</pubDate>
		<dc:creator>Kloplop321</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[competition]]></category>
		<category><![CDATA[integer]]></category>
		<category><![CDATA[modulo]]></category>
		<category><![CDATA[numbers]]></category>
		<category><![CDATA[problem]]></category>

		<guid isPermaLink="false">http://kloplop321.com/php-tutorials/?p=179</guid>
		<description><![CDATA[I&#8217;ve decided to record how to make complete solutions for a certain problem from a High School programming competition, and the solution for it. The problem: You are to write a program which will input a positive integer n and output the number of divisors of n and the sum of those divisors. (Note: by [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to record how to make complete solutions for a certain problem from a High School programming competition, and the solution for it.</p>
<p>The problem: You are to write a program which will input a positive integer n and output the number of<br />
divisors of n and the sum of those divisors. (Note: by divisor we mean a positive integer<br />
divisor this includes 1 and n.)<br />
<object type="application/x-shockwave-flash" style="width: 800px; height: 480px;" data="http://www.youtube.com/v/tyTNyrJEQVk&amp;hl=en_US&amp;fs=1&amp;color1=0x006699&amp;color2=0x54abd6"><param name="movie" value="http://www.youtube.com/v/tyTNyrJEQVk&amp;hl=en_US&amp;fs=1&amp;color1=0x006699&amp;color2=0x54abd6"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param></object></p>
<p>Source code after the jump<br />
<span id="more-179"></span></p>
<pre><code><span class="webhtml1-specialphpmarker">&lt;?php
</span><span class="webhtml1-phpcomment">//Problem 01
</span><span class="webhtml1-phpkeyword">echo</span><span class="webhtml1-phpwhitespace"> </span><span class="webhtml1-phpstring">&quot;Please give me a positive integer: &quot;</span><span class="webhtml1-phpsymbol">;
</span><span class="webhtml1-specialphpvariableprefix">$n</span><span class="webhtml1-phpwhitespace"> = (</span><span class="webhtml1-phpkeyword">int</span><span class="webhtml1-phpsymbol">)</span><span class="webhtml1-phpfunction">trim</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-phpfunction">fgets</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-phpconstant">STDIN</span><span class="webhtml1-phpsymbol">));
</span><span class="webhtml1-specialphpvariableprefix">$d</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpnumber">0</span><span class="webhtml1-phpsymbol">;
</span><span class="webhtml1-specialphpvariableprefix">$s</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpnumber">0</span><span class="webhtml1-phpsymbol">;
</span><span class="webhtml1-phpkeyword">for</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$x</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpnumber">1</span><span class="webhtml1-phpsymbol">; </span><span class="webhtml1-specialphpvariableprefix">$x</span><span class="webhtml1-phpwhitespace"> &lt;= </span><span class="webhtml1-specialphpvariableprefix">$n</span><span class="webhtml1-phpsymbol">; </span><span class="webhtml1-specialphpvariableprefix">$x</span><span class="webhtml1-phpsymbol">++){
    </span><span class="webhtml1-phpkeyword">if</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$n</span><span class="webhtml1-phpsymbol">%</span><span class="webhtml1-specialphpvariableprefix">$x</span><span class="webhtml1-phpwhitespace"> == </span><span class="webhtml1-phpnumber">0</span><span class="webhtml1-phpsymbol">){
        </span><span class="webhtml1-specialphpvariableprefix">$d</span><span class="webhtml1-phpsymbol">++;
        </span><span class="webhtml1-specialphpvariableprefix">$s</span><span class="webhtml1-phpwhitespace"> += </span><span class="webhtml1-specialphpvariableprefix">$x</span><span class="webhtml1-phpsymbol">;
    }
}
</span><span class="webhtml1-phpkeyword">echo</span><span class="webhtml1-phpwhitespace"> </span><span class="webhtml1-phpstring">&quot;</span><span class="webhtml1-phpstringspecial">$n</span><span class="webhtml1-phpstring"> has </span><span class="webhtml1-phpstringspecial">$d</span><span class="webhtml1-phpstring"> divisors and their sum is </span><span class="webhtml1-phpstringspecial">$s</span><span class="webhtml1-phpstring">.</span><span class="webhtml1-phpstringspecial">\n</span><span class="webhtml1-phpstring">&quot;</span><span class="webhtml1-phpsymbol">;

</span><span class="webhtml1-specialphpmarker">?&gt;
</span></code></pre>
]]></content:encoded>
			<wfw:commentRss>http://kloplop321.com/php-tutorials/index.php/2010/02/15/php-programming-competition-problem-01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

