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

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

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.



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.


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







Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili