Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="UTF-8" />
- <title>Document</title>
- </head>
- <body>
- <label>
- <p>Podaj liczbe 1:</p>
- <input type="number" id="numberOne" placeholder="Podaj liczbe 1" />
- </label>
- <p>Podaj liczbe 2:</p>
- <input type="number" id="numberTwo" placeholder="Podaj liczbe 2" />
- <br />
- </label>
- <label>
- <input type="submit" value="Licz!" onclick="oblicz()" />
- </label>
- <p id="wynik"></p>
- <script>
- const date = {
- name: "Jakub",
- surname: "Wojton",
- age: 19,
- growth: 202,
- write: function(){
- alert("Imie: "+this.name+" Nazwisko: " +this.surname+ "Wiek: "+this.age+" Wzrost: "+this.growth);
- }
- }
- date.write();
- function oblicz(){
- const a = document.getElementById('numberOne').value;
- const b = document.getElementById('numberTwo').value;
- const results = document.getElementById('wynik');
- if(b > 0){
- const results2 = (+a + +b)/Math.sqrt(b);
- const roundingUp = Math.floor((+a + +b)/(Math.sqrt(b)) *10) /10;
- const roundingDown = Math.ceil((+a + +b)/(Math.sqrt(b)) *10) /10;
- results.innerHTML = "Wynik to: "+results2+"<br />Zaokraglnie to"+roundingUp+"<br />A tu kolejne "+roundingDown;
- }
- else{
- results.innerHTML = "B nie moze byc mniejsze od 0";
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement