- <head>array fill</head>
- <body>
- <script>
- let i = 0;
- const arr = [];
- let x = 1;
- let n = +prompt("введите кол-во членов прогрессии N");
- for (; i < n; i++) {
- x = x + 3;
- arr.push(x);
- }
- result = ((2 * 1) + 3 * (n - 1)) / 2 * n;
- alert(result);
- </script>
- </body>
|