Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!doctype html>

<html lang="fr">

<head>
  <meta charset="utf-8">
  <meta name="author" content="John Doe">
  <title>Utilitaire optimisation HYIP</title>
  <meta name="description" content="The HTML5 Herald">
  <meta name="author" content="SitePoint">
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
    integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css">
</head>

<!-- Si vous avez des suggestions ou des corrections de bug ou même des idées d'outils à développer,
n'hésitez pas à me contacter:
Facebook: https://www.facebook.com/tim.lerocher.9
Maniabook: https://maniabook.argentmania.com/user/Timothy -->

<body>

  <div class="container">
    <br><br>
    <p>
      Ce utilitaire permet de calculer la meilleure stratégie pour obtenir un rendement maximal sur un plan
      d'investissement. <br><br>
      Entrez votre capital de départ, le pourcentage d'intérêt journalier et la durée de l'investissement.<br><br>

      Le tableau des résultats vous indique jusqu'a quel jour vous devriez réinvestir vos gains avant de commencer à
      les retirer afin de maximiser le bénéfice total sur la durée prévue.
      <br><br>
    </p>
    <div class=row>
      <div class="col-3">
        <form action="/action_page.php">
          <div class="form-group">
            <label for="capital">Capital de départ:</label>
            <input type="number" class="form-control" id="capital">
          </div>
          <div class="form-group">
            <label for="interest">Intérets journaliers:</label>
            <input type="number" class="form-control" id="interest" step="0.01">
          </div>
          <div class="form-group">
            <label for="duration">Durée globale estimée:</label>
            <input type="number" class="form-control" id="duration">
          </div>
          <button type="submit" class="btn btn-primary">Calculer</button>
        </form>
      </div>
      <div class="col-9" id="div-results" style="display: none">
        <p id="results"></p>
        <table class="table">
          <thead>
            <tr>
              <th scope="col">Jour du premier retrait</th>
              <th scope="col">Capital final</th>
              <th scope="col">Nb de retraits</th>
              <th scope="col">Montant retrait quotidien</th>
              <th scope="col">Bénéfice total</th>
            </tr>
          </thead>
          <tbody>
          </tbody>
        </table>
      </div>
    </div>
  </div>
    <script src="https://code.jquery.com/jquery-3.5.1.min.js"
    integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
    integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV"
    crossorigin="anonymous"></script>
  <script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
  </body>

</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                    // Si vous avez des suggestions ou des corrections de bug ou même des idées d'outils à développer,
    // n'hésitez pas à me contacter:
    // Facebook: https://www.facebook.com/tim.lerocher.9
    // Maniabook: https://maniabook.argentmania.com/user/Timothy

    var table;
    $(document).ready(function () {
      table = $('table').DataTable({
        "paging": false,
        "info": false,
        "searching": false
      });


      $('input').on('input', function (e) {
        table
          .clear()
          .draw();
      })

      $('form').submit(function (e) {
        e.preventDefault();

        let capital = parseInt($('#capital').val());
        let interestTx = parseFloat($('#interest').val());
        let duration = parseInt($('#duration').val());

        var results = calc(capital, interestTx, duration)
        for (var result of results) {
          table.row.add(result).draw(false);
        }

        table
          .order([4, 'desc'])
          .draw();

        let html = "Voici les résultats pour un investissement de " + capital + "$ avec un taux d'intérêts journaliers de " + interestTx + "%/jour pour une durée de " + duration + " jours"
        $('#results').html(html);
        $('#div-results').css('display', 'inline')

      });

    });



    const calc = function (capital, interestTx, duree) {
      let results = [];

      let t, capitalTmp, benef, dailyInterest;

      for (var i = 1; i <= duree; i++) {
        capitalTmp = capital;
        for (var j = 0; j < i; j++) {
          capitalTmp += capitalTmp * interestTx / 100;
        }

        dailyInterest = capitalTmp * interestTx / 100
        benef = (duree - i) * dailyInterest;

        results.push([
          i,
          capitalTmp.toFixed(2) + "$",
          Math.round(duree - i),
          dailyInterest.toFixed(2) + "$",
          benef.toFixed(2) + "$",
        ])
      }
      return results;
    }


              
            
!
999px

Console