Gst calculator

 <!DOCTYPE html>

<html>

<head>

  <title>GST Calculator</title>

  <style>

    body {

      font-family: Arial, sans-serif;

      text-align: center;

    }


    .container {

      max-width: 400px;

      margin: 0 auto;

      padding: 20px;

    }


    h1 {

      margin-bottom: 20px;

    }


    .input-group {

      margin-bottom: 10px;

    }


    .input-group label {

      display: block;

      margin-bottom: 5px;

    }


    .input-group input {

      width: 100%;

      padding: 5px;

      border: 1px solid #ccc;

      border-radius: 3px;

    }


    .btn {

      background-color: #4CAF50;

      color: white;

      padding: 10px 20px;

      border: none;

      border-radius: 4px;

      cursor: pointer;

    }


    .result {

      margin-top: 20px;

      font-weight: bold;

    }

  </style>

</head>

<body>

  <div class="container">

    <h1>GST Calculator</h1>

    <div class="input-group">

      <label for="amount">Amount (excluding GST):</label>

      <input type="number" id="amount" min="0">

    </div>

    <div class="input-group">

      <label for="gstRate">GST Rate (%):</label>

      <input type="number" id="gstRate" min="0" max="100">

    </div>

    <button class="btn" onclick="calculateGST()">Calculate GST</button>

    <div class="result" id="result"></div>

  </div>


  <script>

    function calculateGST() {

      var amount = parseFloat(document.getElementById('amount').value);

      var gstRate = parseFloat(document.getElementById('gstRate').value);


      if (isNaN(amount) || isNaN(gstRate)) {

        document.getElementById('result').textContent = 'Please enter valid numbers.';

        return;

      }


      var gstAmount = (amount * gstRate) / 100;

      var totalAmount = amount + gstAmount;


      document.getElementById('result').textContent = 'GST Amount: ' + gstAmount.toFixed(2) + ' | Total Amount: ' + totalAmount.toFixed(2);

    }

  </script>

</body>

</html>