Вопрос задан 17.02.2019 в 19:31. Предмет Информатика. Спрашивает Павлик Женя.

1.вычислить факториал N. (4!=1*2*3*4=24)2.найти среднее геометрическое N чисел3. вычислить сумму

чисел кратных 6 из интервала от 5 до 100 включительно в программе паскаль
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Новикова Анна.
Program gt;
var n,i,p:integer;
begin
read(N);
p:=1;
for i:=2 to n do
begin
p:=p*i;
end;
write(p);
end.
3)
program gt;
var s:integer;
begin
for i:=5 to 100 do
begin
if(i mod 6=0)then s:=s+i;
end;
writeln(s);
end.
2)
program gtr;
var i,n:integer;
p,a:real;
begin
reaD(n);
p:=0;
for i:=1 to n do
begin
read(a);
p:=p+1/a;
end;
p:=n/p;
write(p);
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Calculating Factorial

To calculate the factorial of a number N, you multiply all positive integers less than or equal to N. For example, the factorial of 4 (4!) is calculated as 1 * 2 * 3 * 4, which equals 24.

Factorial of N: The factorial of N is calculated as N! = 1 * 2 * 3 * ... * N.

Geometric Mean of N Numbers

The geometric mean of N numbers is calculated by multiplying all the numbers together and then taking the Nth root of the product.

Geometric Mean Formula: For N numbers x1, x2, ..., xn, the geometric mean is calculated as (x1 * x2 * ... * xn)^(1/N).

Sum of Numbers Divisible by 6 in a Pascal Program

To calculate the sum of numbers divisible by 6 within the range from 5 to 100 inclusive in a Pascal program, you can use a loop to iterate through the numbers in the range and check for divisibility by 6.

Here's a sample Pascal code snippet to achieve this:

``` program SumOfNumbersDivisibleBy6; var i, sum: integer; begin sum := 0; for i := 5 to 100 do begin if (i mod 6 = 0) then sum := sum + i; end; writeln('The sum of numbers divisible by 6 from 5 to 100 is: ', sum); end. ```

In this program, the 'mod' operator is used to check for divisibility by 6, and the 'sum' variable is used to accumulate the sum of numbers divisible by 6 within the specified range.

I hope this helps! If you have any further questions or need additional assistance, feel free to ask.

0 0

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

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

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