Practical – 117.2 : Check Given Year is Leap of Not
Program Code :Â
<!DOCTYPE html>
<html>
<head>
 <title>Leap Year Checker</title>
 <style>
   body {
     font-family: Arial;
     text-align: center;
     margin-top: 50px;
   }
   input, button {
     font-size: 18px;
     margin: 5px;
     padding: 8px;
   }
   #result {
     font-weight: bold;
     margin-top: 15px;
   }
 </style>
</head>
<body>
 <h2>Check Leap Year</h2>
 <input type=”number” id=”year” placeholder=”Enter a year”>
 <button onclick=”checkLeapYear()”>Check</button>
 <div id=”result”></div>
 <script>
   function checkLeapYear() {
     const year = parseInt(document.getElementById(“year”).value);
     let resultText = “”;
     if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) {
       resultText = year + ” is a Leap Year.”;
       document.getElementById(“result”).style.color = “green”;
     } else {
       resultText = year + ” is Not a Leap Year.”;
       document.getElementById(“result”).style.color = “red”;
     }
     document.getElementById(“result”).textContent = resultText;
   }
 </script>
</body>
</html>