fork download
  1. <?php
  2. /*This is my PHP code*/
  3. $K=22.50;
  4. $L=7.5;
  5. $x=0.0;
  6. $a=0.0;
  7. $b=0.0;
  8. $y=0.0;
  9. echo("Please enter value for X\n");
  10. $x=(float)readline();
  11. echo("x=".$x."\n");
  12. if ($x<0)
  13. {
  14. echo("ERROR: the negative value in log or in square root\n");
  15. }
  16. else
  17. {
  18. if (sqrt($x+2.84)<0)
  19. {
  20. echo("ERROR: the negative value in square root\n");
  21. }
  22. else{
  23. $a=(($K**(-0.5))-$L*sqrt($x+2.84))**2;
  24. echo("Result is A=".$a."\n");
  25. }
  26. }
  27. if ($x<=0)
  28. {
  29. echo("ERROR: the negative value or zero value in lg\n");
  30. }
  31. else
  32. {
  33. $b=-log10($x)*exp($x);
  34. echo("Result is B=".$b."\n");
  35. }
  36. if ($a>$b){
  37. if (($a**2)+($b**2)==0) {
  38. echo("ERROR: division by zero\n");
  39. }
  40. else{
  41. $y=(4*$a+3*$b)/(($a**2)+($b**2));
  42. }
  43. }
  44. if ($a<=$b){
  45. $y=abs($a-$b);
  46. }
  47. echo("Final result is Y=".$y."\n");
  48. ?>
Success #stdin #stdout 0.02s 26356KB
stdin
1.426
stdout
Please enter value for X
x=1.426
Result is A=233.47548212732
Result is B=-0.64144820547615
Final result is Y=0.017096988786378