Вопрос задан 18.02.2019 в 13:55. Предмет Информатика. Спрашивает Кусь Марк.

Записать задачу на паскаль. Найдите сумму первых 12 членов арифметической прогрессии, заданной

формулой а=7-3n. Помогите,пожалуйста!
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Лошак Юра.
// PascalABC.NET 3.0, сборка 1144 от 16.01.2016
begin
  Writeln(SeqGen(12,x->7-3*x,1).Sum)
end.

Тестовое решение:
-150
0 0
Отвечает Каменьщикова Полина.
Program n1;
var i:integer;
a:array[1..12] of real;
s:real;
begin
s:=0;
for i:=1 to 12 do
begin
a[i]:=7-3*i;
s:=s+a[i];
end;
writeln(s);
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Writing a Pascal Program to Find the Sum of the First 12 Terms of an Arithmetic Progression

To solve this problem, we can write a Pascal program to find the sum of the first 12 terms of the arithmetic progression defined by the formula a = 7 - 3n. Let's break down the steps to achieve this.

1. Defining the Arithmetic Progression: We have the formula for the arithmetic progression: a = 7 - 3n, where 'a' represents the nth term of the progression.

2. Calculating the Sum of the First 12 Terms: We need to calculate the sum of the first 12 terms of the arithmetic progression. This involves finding the values of 'a' for n = 1 to 12 and then summing these values.

3. Writing the Pascal Program: We will write a Pascal program to implement the above steps and find the sum of the first 12 terms of the given arithmetic progression.

Here's a Pascal program to achieve this:

```pascal program SumOfArithmeticProgression;

var n, a, sum: integer;

begin sum := 0; for n := 1 to 12 do begin a := 7 - 3 * n; sum := sum + a; end; writeln('The sum of the first 12 terms of the arithmetic progression is: ', sum); end. ```

In this program, we use a for loop to iterate through the values of 'n' from 1 to 12, calculate the corresponding term 'a' using the given formula, and then add it to the running total 'sum'. Finally, we display the sum of the first 12 terms of the arithmetic progression.

Conclusion

The Pascal program provided calculates the sum of the first 12 terms of the arithmetic progression defined by the formula a = 7 - 3n. You can run this program in a Pascal compiler to obtain the desired result.

0 0

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

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

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