Thursday, November 12, 2015

Divisible By Five in JavaScript

A simple program that will ask the user to give a number our program will check if the given number by our user is divisible by five or not using JavaScript as our programming language.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.


Sample Program Output


Program Listing

<html>
 <head>
    <title>
 Divisible By Five
 </title>
 </head>
 <style>
        h3 {
    font-family:arial;
    }
</style>  
 <body>
  <h3> Divisible By Five</h3>
<script>
  var value_number = Number(prompt("Enter a Number : "));
 
   if(value_number % 5 == 0)
        {
            document.write("<font face='arial' size='4'> ");
document.write("The number  " +value_number+
" is divisible by 5. </font>");
        }
        else
        {
            document.write("<font face='arial' size='4'> ");
document.write("The number " + value_number+ 
" is not divisible by 5. </font>");
        }
   </script> 
  </body>
 </html>

No comments:

Post a Comment