Create a Divisible application that displays a random integer between 1 and 100 and displays appropriate messages stating whether the integer is even or odd, if the integer is divisible by 2, and if the integer is divisible by 3 when the Generate Number button is clicked. The application interface should look similar to:

Respuesta :

Answer:

function myFunction() {

 myNumber = Math.floor(Math.random() * 100) + 1 ;

 var values = ["Number is even", "Number is odd"] ;

 var stringNum = " ";

 if (myNumber % 2 === 0){

     stringNum += values[0];

 } else {

     stringNum += values[1];

 document.getElementById("demo").innerHTML = stringNum;

}

Explanation:

The javascript source code is used by the browser to make the web application interactive, making a clickable event for the button to generate an H1 header for the web page.

The myFunction is assigned to an onclick event of a html button tag to display if a random number between 1 and 100 is even or odd.