Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <head>
- <title>Training</title>
- </head>
- <body>
- <button onclick="math1()">Generate</button>
- <p id="text1"></p>
- <button onclick="math2()">Generate</button>
- <p id="text2"></p>
- <button onclick="math3()">Generate</button>
- <p id="text3"></p>
- <button onclick="math4()">Generate</button>
- <p id="text4"></p>
- <button onclick="math5()">Generate</button>
- <p id="text5"></p>
- <button onclick="math6()">Generate</button>
- <p id="text6"></p>
- <script>
- //Math.random() //Returns number lower than 0.
- function math1()
- {
- document.getElementById("text1").innerHTML = Math.random();
- }
- //Math.min()
- function math2()
- {
- document.getElementById("text2").innerHTML = Math.min(14, 27, 8, 34); //Return the lowest number.
- }
- //Math.max()
- function math3()
- {
- document.getElementById("text3").innerHTML = Math.max(14, 27, 8, 34); //Returns the biggest number.
- }
- //Math.round()
- function math4()
- {
- document.getElementById("text4").innerHTML = Math.round(4.4); //Returns the nearest number.
- }
- //Math.ceil()
- function math5()
- {
- document.getElementById("text5").innerHTML = Math.ceil(4.4); //Rounds a number up to the nearest integer.
- }
- //Math.floor()
- function math6()
- {
- document.getElementById("text6").innerHTML = Math.floor(4.4); //Rounds a number down to the nearest integer.
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement