import random
N = [random.randint(0, 100) for i in range(10)]
print ("Array is:", N)
sum_less_50 = 0
Count_less_50 = 0
sum_more_50 = 0
Count_more_50 = 0
for elem in N:
if elem >= 50:
Count_more_50 += 1
sum_more_50 += elem
else:
Count_less_50 += 1
sum_less_50 += elem
print("Awerage of nums, that < 50: ", end = "")
if Count_less_50 > 0:
print(sum_less_50 / Count_less_50)
print(0)
print("Awerage of nums, that >= 50: ", end= "")
if Count_more_50 > 0:
print(sum_more_50 / Count_more_50)
1.
program pifagor;
var
a,b:real;
begin
write('Введите катеты 》 ');
read(a,b);
write('Гипотенуза 》 ',sqrt(sqr(a)+sqr(b)));
end.
2.
program temp2;
a:integer;
write('Введите число 》 ');
read(a);
write('Последняя цифра числа 》 ',a mod 10)
3.
write('Введите трехзначное число 》 ');
write('Сумма цифр числа = ',a div 100+a div 10 mod 10+a mod 10);
4.
A=50
B=20
A=40-30=10
10<20
C=2×10=20
5.
program kratnost;
x:integer;
write('Введите X 》 ');
read(x);
if(x mod 5=0)
then
write('X Делится на 5')
else
write('X Не делится на 5')
import random
N = [random.randint(0, 100) for i in range(10)]
print ("Array is:", N)
sum_less_50 = 0
Count_less_50 = 0
sum_more_50 = 0
Count_more_50 = 0
for elem in N:
if elem >= 50:
Count_more_50 += 1
sum_more_50 += elem
else:
Count_less_50 += 1
sum_less_50 += elem
print("Awerage of nums, that < 50: ", end = "")
if Count_less_50 > 0:
print(sum_less_50 / Count_less_50)
else:
print(0)
print("Awerage of nums, that >= 50: ", end= "")
if Count_more_50 > 0:
print(sum_more_50 / Count_more_50)
else:
print(0)
1.
program pifagor;
var
a,b:real;
begin
write('Введите катеты 》 ');
read(a,b);
write('Гипотенуза 》 ',sqrt(sqr(a)+sqr(b)));
end.
2.
program temp2;
var
a:integer;
begin
write('Введите число 》 ');
read(a);
write('Последняя цифра числа 》 ',a mod 10)
end.
3.
program pifagor;
var
a:integer;
begin
write('Введите трехзначное число 》 ');
read(a);
write('Сумма цифр числа = ',a div 100+a div 10 mod 10+a mod 10);
end.
4.
A=50
B=20
A=40-30=10
10<20
C=2×10=20
5.
program kratnost;
var
x:integer;
begin
write('Введите X 》 ');
read(x);
if(x mod 5=0)
then
write('X Делится на 5')
else
write('X Не делится на 5')
end.