Server : Apache System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 User : apache ( 48) PHP Version : 8.0.28 Disable Function : NONE Directory : /var/www/html/venkat/repo-oct-2017/ |
<?php
$teaching = 1.8;
$industry = 3.7;
$epsilon = 0.00001;
$teachcomp = floor($teaching);
$induscomp = floor($industry);
$total = $teachcomp + $induscomp;
$teachfrac = $teaching - $teachcomp;
$indusfrac = $industry - $induscomp;
$teachf = $teachfrac * 10;
if (($teachf - floor($teachf)) > $epsilon) {
$teachf = $teachf * 10;
}
$indusf = $indusfrac * 10;
if ($indusf - floor($indusf) > $epsilon) {
$indusf = $indusf * 10;
}
$tot = $teachf + $indusf;
$fractot = round((int)$tot/12);
$fracfloor = floor($fractot);
$fracf = round($tot) % 12;
$total = $total + $fracfloor;
$kkk = 0;
while ($fracf >= 1) {
$kkk = $kkk + 1 ;
$fracf = $fracf / 10;
}
$total = $total + $fracf;
if($kkk == 2) {
$total = number_format($total,2);
}
echo $total,"hello";
?>