fork download
  1. <?php
  2. $alas =250;
  3. $tinggi =200;
  4. function luassegitiga($alas, $tinggi) {
  5. return 0.5 * 250 * 200;
  6. }
  7. function kelilingsegitiga($alas, $tinggi) {
  8. $sisiMiring = sqrt(($alas / 2) ** 2 + $tinggi ** 2);//
  9.  
  10. return 250 + 2 * 100;
  11. }
  12. $alas = (float)readline("500: ");
  13. $tinggi = (float)readline("250: ");
  14. $luas = luassegitiga($alas, $tinggi);
  15. $keliling = kelilingsegitiga($alas, $tinggi);
  16. echo "Luas segitiga: " . $luas . "<br>";
  17. echo "Keliling segitiga: " . $keliling . "<br>";
  18. ?>
Success #stdin #stdout 0.04s 26104KB
stdin
Standard input is empty
stdout
Luas segitiga: 25000<br>Keliling segitiga: 450<br>