Site icon T4Tutorials.com

Leap year program flowchart and program in Javascript JS with form values entered by user

Leap year program flowchart and program in Javascript JS with form values entered by user

In this tutorial, we will try to learn the followings;

  1. Flowchart of Leap year program.
  2. Leap year program.
  3. Leap year program with form values entered by user.

Flowchart of Leap year program.

leap year program flowchart Javascript JS form values entered by user
Figure: leap year program flowchart 

Leap year program.

<html>
<head>
<script>
function leapyear()
{
var x;
x=2019;
if( (0 == x % 4) && (0 != x % 100) || (0 == x % 400) )
{
alert(x+" is a leap year: Congratulations");  
}
else
{
alert(x+" is not a leap year: Sorry");  
}
}
</script>
</head>
<body>
<h2>Javascript (JS) Program to find leap year</h2>
<h2>Given the year of 2019:</h2>
<button onclick="leapyear()">Check</button>
</body>
</html>

Leap year program with form values entered by user.

<html>
<head>
<script>
function leapyear()
{
var x;
x = document.getElementById("demo").value;
if( (0 == x % 4) && (0 != x % 100) || (0 == x % 400) )
{
alert(x+" is a leap year");  
}
else
{
alert(x+" is not a leap year");  
}
}
</script>
</head>
<body>
<h2>Javascript Program to find leap year</h2>
<input type="text" id="demo"></input>
<button onclick="leapyear()">Check</button>
</body>
</html>

[su_highlight background=”#f01818″ color=”#f5fee9″]
List of All Programs of Javascript : Click Here[/su_highlight]
.

Exit mobile version