Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Write a program, input an integer representing minutes from the keyboard, convert the integer into the format expressed in hours and minutes, and output.
Write a program, input an integer representing minutes from the keyboard, convert the integer into the format expressed in hours and minutes, and output.
Through programming in JS language, examples are shown as follows:

1. Design a simple interface with the following html code:

The css style code is as follows:

The page at this time is as follows:

2. Design and implement this function. The specific code is as follows, bind the button in the first step.

The html code at this time is as follows:

3. After the design is completed, give a demonstration, enter the total number of minutes, for example, 200, and then click Convert to perform the following operations.

Extended data:

Functional analysis of topic: JavaScriptfloor () method. The floor () method performs a round-down calculation, which returns the nearest integer less than or equal to the function parameter.

1, definition and usage: The floor () method can round down a number.

2. Grammar: Math.floor(x), required by x, any numerical value or expression.

3. Return value: an integer less than or equal to X and closest to X. ..

More examples:

The outputs are: 0, 0, 5, 5, -6 and -6 respectively.