Вопрос задан 03.09.2020 в 12:20. Предмет Информатика. Спрашивает Цепляев Дима.

 4 Σ    (S!+S) S=1  найдите ошибку, плиз program mar;uses crt;var

F,S:integer;k:real;beginclrscr;F:=1;k:=0;for S:=1 to 4 dobeginF:=F*S;k:=k*(F+S);end;writeln('k =',k:4:2);readkey;end.  
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

The code you provided seems to have a few errors. Let's go through them step by step:

1. The line `program mar;` should be changed to `program mar;`. 2. The line `uses crt;` is unnecessary and can be removed. 3. The line `var F, S: integer;` is missing a semicolon at the end. It should be `var F, S: integer;`. 4. The line `k: real;` is missing a semicolon at the end. It should be `k: real;`. 5. The line `beginclrscr;` should be changed to `begin clrscr;`. 6. The line `for S := 1 to 4 do` is missing a space between `to` and `4`. It should be `for S := 1 to 4 do`. 7. The line `F := F * S;` is correct. 8. The line `k := k * (F + S);` is incorrect. It should be `k := k + (F + S);` to calculate the sum of `k`, `F`, and `S`. 9. The line `writeln('k+=', k:4:2);` is correct. 10. The line `readkey;` is correct. 11. The line `end.` is missing a semicolon at the end. It should be `end;`.

Here's the corrected code:

```pascal program mar; var F, S: integer; k: real; begin clrscr; F := 1; k := 0; for S := 1 to 4 do begin F := F * S; k := k + (F + S); end; writeln('k = ', k:4:2); readkey; end; ```

This code calculates the value of `k` using a loop. It multiplies `F` by `S` in each iteration and adds the sum of `F` and `S` to `k`. Finally, it prints the value of `k`.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос