NEP -PHP PROGRAMMING

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10 PROGRAM 11 PROGRAM 12 PROGRAM 13 PROGRAM 14

PART B

. . .

3

 
  
  
 3 Write a PHP script to reverse a given number and calculate its sum.

< ? php  
$num = 23456;  
$revnum = 0;  

$sum=0;
while ($num > 1)  
{  

$rem = $num % 10;  
$revnum = ($revnum * 10) + $rem;  
$num = ($num / 10); 

$sum=$sum+$rem; 
 
}  

echo "<br>Reverse number of 23456 is: $revnum";  
echo "<br>Sum of  number of 23456 is: $sum"; 

? >