Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- </head>
- <body>
- <form>
- <p>pierwsza liczba:</p><input type = "number" value="0" id="input1">
- <br />
- <p>druga liczba:</p><input type = "number" value="0" id="input2">
- <br />
- <p>trzecia liczba:</p><input type = "number" value="0" id="input3">
- <br />
- <p>czwarta liczba:</p><input type = "number" value="0" id="input4">
- <input type ="button" value="submit" id="subyeet" onclick="inputo1()">
- <div id="idk"></div>
- </form>
- <script>
- let t1 = new Array ();
- function inputo1()
- {
- let min, max, srednia;
- let grab1 = document.getElementById("input1").value;
- let grab2 = document.getElementById("input2").value;
- let grab3 = document.getElementById("input3").value;
- let grab4 = document.getElementById("input4").value;
- t1[0] = Number(grab1.value);
- t1[1] = Number(grab2.value);
- t1[2] = Number(grab3.value);
- t1[3] = Number(grab4.value);
- for (let i =0; i <=t1.length; i++)
- {
- if(i=0)
- {
- min = t1[i];
- max = t1[i];
- }
- else{
- if(t1[i]>max) max = t1[i];
- if(t1[i]>min) min = t1[i];
- }
- }
- return (wynik);
- document.getElementById("idk").innerHTML=wynik;
- }
- // napisac aplikacje pozwalajaca na obliczenie sumy i sredniej arytmetycznej oraz wyznaczenie wartosci najwiekszej i najmniejszej elementow zapammietanych w 4 elementowej tablicy
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement