<?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>Write the Program to calculate Even Odd Program in PHP Archives - Artificial Intelligence</title>
	<atom:link href="https://www.aiuniverse.xyz/tag/write-the-program-to-calculate-even-odd-program-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.aiuniverse.xyz/tag/write-the-program-to-calculate-even-odd-program-in-php/</link>
	<description>Exploring the universe of Intelligence</description>
	<lastBuildDate>Fri, 28 Apr 2023 12:46:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>PHP Interview Question</title>
		<link>https://www.aiuniverse.xyz/php-interview-question/</link>
					<comments>https://www.aiuniverse.xyz/php-interview-question/#respond</comments>
		
		<dc:creator><![CDATA[Maruti Kr.]]></dc:creator>
		<pubDate>Fri, 28 Apr 2023 09:56:42 +0000</pubDate>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[PHP Interview Question]]></category>
		<category><![CDATA[Write the code to calculate sum of each digit in PHP.]]></category>
		<category><![CDATA[Write the code to Factorial in PHP]]></category>
		<category><![CDATA[Write the code to Print Table of a Number]]></category>
		<category><![CDATA[Write the Program in PHP to calculate the given number is Prime number or not ?]]></category>
		<category><![CDATA[Write the Program to calculate Even Odd Program in PHP]]></category>
		<guid isPermaLink="false">https://www.aiuniverse.xyz/?p=16574</guid>

					<description><![CDATA[<p>Write the code to calculate sum of each digit in PHP. Output: Write the Program to calculate Even Odd Program in PHP Output: Write the Program in <a class="read-more-link" href="https://www.aiuniverse.xyz/php-interview-question/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/php-interview-question/">PHP Interview Question</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Write the code to calculate sum of each digit in PHP.</h2>



<pre class="wp-block-code"><code>&lt;?php  
$num = 12345;  
$sum=0; $rem=0;  
  for ($i =0; $i&lt;=strlen($num);$i++)  
 {  
  $rem=$num%10;  
   $sum = $sum + $rem;  
   $num=$num/10;  
  }  
 echo "Sum of digits 12345 is $sum";  
 ?&gt;  </code></pre>



<p><strong>Output:</strong></p>



<pre class="wp-block-code"><code>Sum of digits 12345 is 15</code></pre>



<h2 class="wp-block-heading">Write the Program to calculate Even Odd Program in PHP</h2>



<pre class="wp-block-code"><code>&lt;?php  
$number=28462;  
if($number%2==0)  
{  
 echo "$number is Even Number";   
}  
else  
{  
 echo "$number is Odd Number";  
}   
?&gt;  </code></pre>



<p><strong>Output:</strong></p>



<pre class="wp-block-code"><code>28462 is Even Number</code></pre>



<h2 class="wp-block-heading">Write the Program in PHP to calculate the given number is Prime number or not ?</h2>



<p>Here, We&#8217;ll print first 15 prime numbers.</p>



<pre class="wp-block-code"><code>&lt;?php  
$count = 0;  
$num = 2;  
while ($count &lt; 15 )  
{  
$div_count=0;  
for ( $i=1; $i&lt;=$num; $i++)  
{  
if (($num%$i)==0)  
{  
$div_count++;  
}  
}  
if ($div_count&lt;3)  
{  
echo $num." , ";  
$count=$count+1;  
}  
$num=$num+1;  
}  
?&gt;  </code></pre>



<p><strong>Output:</strong></p>



<pre class="wp-block-code"><code>2,3,5,7,11,13,17,19,23,29,31,37,41,43,47</code></pre>



<h2 class="wp-block-heading">Write the code to Print Table of a Number</h2>



<p>Here , We&#8217;ll print the table of&nbsp;3.</p>



<pre class="wp-block-code"><code>&lt;?php    
define('a', 3);   
for($i=1; $i&lt;=10; $i++)   
{   
  echo $i*a;   
  echo '&lt;br&gt;';     
}  
?&gt;  </code></pre>



<p><strong>Output:</strong></p>



<pre class="wp-block-code"><code>3
6
9
12
15
18
21
24
27
30</code></pre>



<h2 class="wp-block-heading">Write the code to Factorial in PHP</h2>



<pre class="wp-block-code"><code>&lt;?php  
$num = 4;  
$factorial = 1;  
for ($x=$num; $x&gt;=1; $x--)   
{  
  $factorial = $factorial * $x;  
}  
echo "Factorial of $num is $factorial";  
?&gt;  </code></pre>



<p><strong>Output:</strong></p>



<pre class="wp-block-code"><code>Factorial of 4 is 24</code></pre>
<p>The post <a href="https://www.aiuniverse.xyz/php-interview-question/">PHP Interview Question</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/php-interview-question/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
