JavaScript :- Railway Ticket Bill (if...else if)
This is JavaScript Practical :- Railway Ticket Bill (if...else if).
Script written in small letter because JavaScript Case Sensitive.
Script:-
<html>
<head>
<title>Railway Price With Discount</title>
</head>
<body>
<script type="text/javascript">
// this is a railway tickets
var age,amt=0,price;
price=parseInt(prompt("Enter Price"));
age=parseInt(prompt("Enter Age"));
if(age >= 60)
{
amt=price-(price*40/100);
document.write("Amount of railway tickets = ",amt);
}
else if(age >= 12 && age <= 59)
{
amt=price
document.write("Amount of railway tickets = ",amt);
}
else
{
amt=price-(price*50/100);
document.write("Amount of railway tickets = ",amt);
}
</script>
</body>
</html>
Save the File .html
Output:-
If you have any doubts mention on the Comment Box.
Please follow the my Blog, Share and Comment.
Comments
Post a Comment