Python
from random import randint
def getH(s):
while s>10:
s=s//10
return s
n=int(input('Введите размер массива: '))
a=[0]*n
b=0
for i in range(0, n-1):
a[i]=randint(0, 1000)
if getH(a[i])==8:
b+=1
print(a)
print('Элементов начинающихся с 8 =',b)
# задание 2
a=sorted(a)
i=1
b=1
print('3 минимальных элемента')
print(a[0])
while b<3 and b<n:
if a[i]!=a[i-1]:
print(a[i])
b+=1
i+=1
>>Введите размер массива: 45
[464, 937, 662, 266, 915, 535, 690, 663, 441, 791, 979, 831, 853, 92, 411, 429, 845, 949, 116, 178, 129, 434, 824, 802, 643, 41, 612, 654, 361, 503, 141, 290, 13, 401, 157, 55, 376, 960, 856, 869, 194, 913, 447, 639, 0]
Элементов начинающихся с 8 = 7
3 минимальных элемента
0
13
41
Язык — Java
Очевидно, что я пишу не на том языке, на каком надо, ведь ты не отметил нужный.
Но если ты попросишь, может мне и будет хватать сил писать псевдокод :D
import java.util.Scanner;
public class Znanija {
public static void main(String args[]) {
double x, y, z;
double real, denominator, numerator, numerator1, fraction;
Scanner input = new Scanner(System.in);
System.out.println("Enter the value of \"x\": ");
x = input.nextInt();
System.out.println("\nEnter the value of \"y\": ");
y = input.nextInt();
System.out.println("Input the value of \"z\": ");
z = input.nextInt();
denominator = Math.pow(x+y, 6);
numerator = Math.pow((Math.pow((Math.sqrt(((x*x)+(y*y, 1.71)), 3);
numerator1 = numerator+(Math.pow(x+y, 2)+1);
fraction = denominator/numerator;
if (z > fraction) {
System.out.println("\nThe value of \"z\" is greater, then the equation, so here's the result: " + Math.pow(z, 2));
}
else if (z == fraction) {
System.out.println("\nThe values of both variables are equal, so here's the result: " + z);
}
else {
System.out.println("\nThe value of \"z\" is lees then the eqation, so here's the result: " + Math.sqrt(z));
}
}
}
ответ:Транизисторлар 4 ғ