<?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>PHPDone &#187; asim</title>
	<atom:link href="http://www.phpdone.com/blog/author/asim/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpdone.com/blog</link>
	<description>Teach Yourself PHP</description>
	<lastBuildDate>Thu, 08 Apr 2010 09:10:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Problem and Solution!</title>
		<link>http://www.phpdone.com/blog/2009/11/problem-and-solution/</link>
		<comments>http://www.phpdone.com/blog/2009/11/problem-and-solution/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 17:48:10 +0000</pubDate>
		<dc:creator>asim</dc:creator>
				<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://www.phpdone.com/blog/?p=121</guid>
		<description><![CDATA[I found an interesting problem on net and as a noivce decided to solve it all by self with the help of PHP.
Problem:&#8221;If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of [...]]]></description>
			<content:encoded><![CDATA[<p>I found an interesting problem on net and as a noivce decided to solve it all by self with the help of PHP.<br />
Problem:&#8221;If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.</p>
<p>Find the sum of all the multiples of 3 or 5 below 1000.<br />
&#8221;<br />
Solution:<br />
&#8220;&lt;?php<br />
for($counter=1; $counter &lt; 1000 ; $counter ++)<br />
{<br />
//echo &#8221;</p>
<p>&#8220;;<br />
//echo &#8221;<br />
<strong>&#8220;.$counter.&#8221;&#8211;&gt;</strong> &#8220;;</p>
<p>$int_var1 = ($counter/3); //current counter will be divided by 3<br />
$int_var2 = ($counter/5); //current counter will be divided by 5</p>
<p>$str_type1 = gettype($int_var1); //This will return integer if counter was divided by 3 properly<br />
$str_type2 = gettype($int_var2); //This will return integer if counter was divided by 5 properly</p>
<p>if ($str_type1 == &#8216;integer&#8217; || $str_type2 == &#8216;integer&#8217; ) //to check which &#8220;counter&#8221; was properly divided<br />
{<br />
//echo &#8220;This is integer&#8221;;<br />
$int_result = $int_result+$counter;</p>
<p>}<br />
else<br />
{<br />
//echo &#8221; NON INTEGER&#8221; ;<br />
}<br />
}<br />
echo &#8220;<strong>Result is: $int_result </strong> &#8220;;</p>
<p>?&gt;<br />
&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpdone.com/blog/2009/11/problem-and-solution/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
