Sum Value in php

 <?php

 $sum = 1123;

 $num =0;

 while($sum>=1){

 

 $rem = $sum%10;

 $num = $num+$rem;

 $sum = $sum/10;

  

 }

 

 echo $num;

 

?>


Comments

Popular posts from this blog

My Sql Query ..

Interview question laravel.