Skip to content
Snippets Groups Projects
Select Git revision
  • f9c23a7d0ffc8b824de06fff81bca9b7ab45c7b5
  • main default protected
2 results

ex5d.php

Blame
  • SofianeLasri's avatar
    Sofiane Lasri authored
    4c2e4a1d
    History
    ex5d.php 743 B
    <?php
    if(isset($_GET['seuil'])){
        $atteindre = $_GET['seuil'];
    }else{
        $atteindre = 18000;
    }
    if(isset($_GET['capitalInitial'])){
        $init = $_GET['capitalInitial'];
    }else{
        $init = 10000;
    }
    if(isset($_GET['targetYears'])){
        $targetYears = $_GET['targetYears'];
    }else{
        $targetYears = 10;
    }
    
    $taux = ($atteindre - $init) / $targetYears;
    
    $total = $init;
    $nbAnnees = 0;
    while($total < $atteindre){
        $total *= $taux;
        $nbAnnees++;
    }
    ?>
    <h1>Dépassement d'un seuil donné</h1>
    <p>Seuil à atteindre : <?=$atteindre?> €</p>
    <p>Captial Intial : <?=$init?> €</p>
    <p>Taux d'intérêt pour <?=$targetYears?> année(s) : <?php echo ($taux - 1) * 100; ?> %</p>
    
    <p>Capital en début d'année <?=$nbAnnees?> : <?=$total?> €</p>