# Field Manual for Hackers

## PHP - Write a program to calculate gross salary.

Conditions

• DA=70% and HRA=10% if basic salary<15000.
• DA=98% and HRA=500 if basic salary>=15000.
• NO DA HRA   if salary <10000

1. This comment has been removed by the author.

2. ";

if(\$salary<15000)
{
\$da=(70*\$salary)/100;
\$hra=(98*\$salary)/100;
\$gross_salary=\$salary+\$da+\$hra;
echo "The gross salary is: ".\$gross_salary;
echo "
";
}

elseif(\$salary>=15000)
{
\$da=(98*\$salary)/100;
\$hra=500;
\$gross_salary=\$salary+\$da+\$hra;
echo "The gross salary is: ".\$gross_salary;
echo "
";
}

else
{
\$gross_salary=\$salary;
echo "The gross salary is: ".\$gross_salary;
echo "
";
}
?>

3. This comment has been removed by the author.

4. This comment has been removed by the author.

5. php
\$num=\$_POST['salary'];
if(\$num<10000)
{\$gs=\$num;
echo "the gross salary is :\$gs";
}
else if(\$num>10000&&\$num<15000)
{\$gs=\$num+0.7*\$num+0.1*\$num;
echo "the gross salary is: \$gs";
}
else if(\$num>15000)
{\$gs=\$num+0.5*\$num+0.98*\$num;
echo " the gross salary is :\$gs";
}

6. This comment has been removed by the author.

7. \$basicsalary=\$_GET["salary"];
if(\$basicsalary>=15000)
\$gs=\$basicsalary+\$basicsalary*0.98+500;
else if(\$basicsalary<15000&&\$basicsalary>=10000)
\$grossalary=\$basicsalary+\$basicsalary*0.7+\$basicsalary*0.10;
else if(\$n<10000)
\$grossalary=\$n;
echo "Gross salary=\$grossalary";

8. ?php
\$bs=\$_post["basic salary"];
if(\$bs<15000)
{
\$d=0.7*\$bs;
\$hr=0.1*\$bs;}
else
if(bs>=15000)
{\$d=0.98*\$bs;
\$hr=500;}
else
if(\$bs<10000)
{ \$d=0;
\$hr=0;}
\$gs=\$bs+\$d+\$hr;
echo"gross salary is:"."\$gs";
?>