Shared Codes


SHARED CODE HERE !!!

<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8">

  <title>Student Grade Calculator</title>

  <style>

    body {

      font-family: Arial, sans-serif;

      background: #f4f4f4;

      padding: 40px;

      display: flex;

      justify-content: center;

    }

    .container {

      background: white;

      padding: 30px;

      border-radius: 10px;

      box-shadow: 0 0 10px rgba(0,0,0,0.1);

      max-width: 400px;

      width: 100%;

    }

    h2 {

      text-align: center;

      margin-bottom: 20px;

    }

    input {

      width: 100%;

      padding: 10px;

      margin: 10px 0;

      font-size: 16px;

    }

    button {

      width: 100%;

      padding: 10px;

      background: #007bff;

      color: white;

      border: none;

      font-size: 16px;

      cursor: pointer;

      border-radius: 5px;

    }

    button:hover {

      background: #0056b3;

    }

    .result {

      margin-top: 20px;

      text-align: center;

      font-weight: bold;

      font-size: 18px;

    }

  </style>

</head>

<body>

  <div class="container">

    <h2>Grade Calculator</h2>

    <input type="text" id="name" placeholder="Student Name">

    <input type="number" id="maths" placeholder="Maths Marks">

    <input type="number" id="science" placeholder="Science Marks">

    <input type="number" id="english" placeholder="English Marks">

    <button onclick="calculateGrade()">Calculate Grade</button>

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

  </div>


  <script>

    function calculateGrade() {

      const name = document.getElementById("name").value;

      const maths = parseInt(document.getElementById("maths").value);

      const science = parseInt(document.getElementById("science").value);

      const english = parseInt(document.getElementById("english").value);


      if (isNaN(maths) || isNaN(science) || isNaN(english)) {

        alert("Please enter valid marks for all subjects.");

        return;

      }


      const total = maths + science + english;

      const average = total / 3;


      let grade = "";


      if (average >= 90) grade = "A";

      else if (average >= 80) grade = "B";

      else if (average >= 70) grade = "C";

      else if (average >= 60) grade = "D";

      else grade = "F";


      document.getElementById("result").innerText = `${name}'s Grade: ${grade}`;

    }

  </script>

</body>

</html>

https://docs.google.com/spreadsheets/d/12MmFfMA5iivRUQWIQP5I01OLEqZb8TEY/edit?usp=sharing&ouid=102556895812921324179&rtpof=true&sd=true


https://drive.google.com/drive/folders/1xE21vk4Pm8CXx92TfGFkoBnY8Sl65BnH

0 Comments