February 2019 0 30 Report
Prosze o przerobienie skryptu js. zamiast zmiennych zeby byly tablice zastosowane, srednia wylosowanych liczb oraz ich suma,i najwieksza i najmniejsza wylosowana liczba

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
document.write("<table border=\"2\">");
var x = 0;
var suma = 0;
var i=1;
var warunek = prompt("Wybierz losowane liczby | 0 - parzyste, 1 - nieparzyste");
if(warunek=='0'){
while(i<11)
{
x = Math.floor(Math.random() * 100);
if (x % 2 == 0){
document.write("<tr><td>" + i + "</td><td width=\"200\"><font color=\"green\"> " +x+"</font></td></tr>");
suma = suma+x;
i++;
}
}
}
else if(warunek=='1'){
while(i<11)
{
x = Math.floor(Math.random() * 100);
if (x % 2 != 0){
document.write("<tr><td>" + i + "</td><td width=\"200\"><font color=\"red\">"+x+"</font></td></tr>");
suma = suma+x;
i++;
}
}
}
else{
document.write("Wybrałes zła opcje");
}


document.write("<tr><td>Suma: </td><td width=\"200\"><b>"+suma+"</td></tr>");
document.write("</table>");
</script>
</body>
</html>


More Questions From This User See All

Recommend Questions



Life Enjoy

" Life is not a problem to be solved but a reality to be experienced! "

Get in touch

Social

© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.