PHP ZCE mock test, interview preparation, daily lessons under chalk talk

Thursday, January 12, 2012

ZCE Zend Certified Engineer Number Format Problem


View the Complete Blog on ZCE

<?php

$a = 1;
$b = 2.5;
$c = 0xFF;

$d = $b + $c;
$e = $d * $b;
$f = ($d + $e) % $a;

print ($f + $e);

?>
Solution:
$c = 0xFF => 255
$d = $b+$c => 257.5
$e = $d * $b => 643.75
$f = ($d+$e) % $a => ($d+$e) % 1 =>0
therefore answer is 643.75

No comments:

Post a Comment