Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions js1/1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>1</title>
</head>
<body>

<script type="text/javascript">

var digit1 = Number(prompt('Введите первое число')),
digit2 = Number(prompt('Введите второе число')),
digit3 = Number(prompt('Введите третье число'));
digit4 = Number(prompt('Введите четвертое число'));

if(digit1 > digit2 && digit1 > digit3 && digit1 > digit4) {
alert(digit1);
}
else if(digit2 > digit1 && digit2 > digit3 && digit1 > digit4) {
alert(digit2);
}
else if (digit3 > digit1 && digit3 > digit2 && digit3 > digit4) {
alert(digit3);
}
else if (digit4 > digit1 && digit4 > digit2 && digit4 > digit3) {
alert(digit4);
}

summ = Math.pow(digit1, -1) + Math.pow(digit2, -1) + Math.pow(digit3, -1) + Math.pow(digit4, -1);

summ2 = summ / 4;

summ3 = Math.pow(summ2, -1);

alert('среднее гармоническое этих четырёх чисел =' + summ3);



</script>

</body>
</html>
31 changes: 31 additions & 0 deletions js1/2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2</title>
</head>
<body>

<script type="text/javascript">

var digit1 = Number(prompt('Введите первое число')),
digit2 = Number(prompt('Введите второе число')),
digit3 = Number(prompt('Введите третье число'));

summ = digit1 + digit2;
summ2 = digit1 + digit3;
summ3 = digit2 + digit3;

if(digit1 < summ && digit1 < summ2 && digit1 < summ3 && digit2 < summ && digit2 < summ2 && digit2 < summ3 && digit3 < summ && digit3 < summ2 && digit3 < summ3) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Избыточное условие. Нужно проверить, чтобы сумма двух сторон была не меньше третьей, а не каждой из трех

alert("Вы ввели числа привильно");
}
else{
alert("вводите первые от наибольшего к наименьшему ; пример: 7, 4, 3тье число должно быть меньше 7+4 и меньше 7");
}


</script>

</body>
</html>
25 changes: 25 additions & 0 deletions js1/3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3</title>
</head>
<body>

<script type="text/javascript">

var digit1 = Number(prompt('Введите первое число')),
digit2 = Number(prompt('Введите второе число'));

if( digit1 % digit2 == 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Используйте строгое сравнение

alert("Остатка нет");
}
else{
alert("Остаток есть");
}

</script>

</body>
</html>
28 changes: 28 additions & 0 deletions js1/4.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>4</title>
</head>
<body>

<script type="text/javascript">

var digit1 = Number(prompt('Введите число 1099511627776'));

d1 = digit1 / 1024;

d2 = digit1 / 1048576;

d3 = digit1 / 1073741824;

alert(digit1 + "Байт");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно было вывести только одну единицу - самую подходяющую для значения

alert(d1 + "Килобайт");
alert(d2 + "Мегабайт");
alert(d3 + "Гигагабайт");

</script>

</body>
</html>
27 changes: 27 additions & 0 deletions js1/5.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>5</title>
</head>
<body>

<script type="text/javascript">

var a = Number(prompt('Введите число 1'));
var b = Number(prompt('Введите число 2'));
var c = Number(prompt('Введите число 3'));

p = 1/2 * (a + b + c);

s = p * (p - a) * (p - b) * (p - c);

s2 = Math.sqrt(s)

alert("Площать теугольника" + s2);

</script>

</body>
</html>
22 changes: 22 additions & 0 deletions js1/6.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>6</title>
</head>
<body>

<script type="text/javascript">

var year = Number(prompt('Введите год'));

if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Используйте строгие сравнения и отрицания

alert("Год високосный");
}
else
alert("Год не високосный");
</script>

</body>
</html>