Asqaraliyev Islomjon 111 20-g


Download 82.67 Kb.
Sana14.05.2023
Hajmi82.67 Kb.
#1462253
Bog'liq
Asqaraliyev Islomjon 111 20-G P 2-M


Asqaraliyev Islomjon 111 20-g.
2-Modul.

3-variant


  1. Butun sonli A(1:10, 1:10) massivda bir xil elementlar mavjud yoki mavjud emasligini aniqlang.

a0=[]
a01=[]


for i in range(0,10,1):
a1=int(input("hadini kiriting"))
a0.append(a1)
for i in range(0,10,1):
a2=int(input("hadini kiriting"))
a01.append(a2)
for i in range(0,10,1):
for e in range(0,10,1):
if a0[i]==a01[e]:
print(a0[i])
aa=[a0,a01]
print(aa)





  1. N butun soni va haqiqiy sonli B(1:n,1:n) massiv berilgan. Hisoblang:

. Bu yerda -B ning i-satridagi eng katta element, -esa B ning
j ustunidagi eng kichik element.

n=int(input("n ni kiriting"))


a0=[]
a01=[]
Sum=0
for i in range(0,n,1):
a1=int(input("hadini kiriting"))
a0.append(a1)
for i in range(0,n,1):
a2=int(input("hadini kiriting"))
a01.append(a2)
for i in range(0,n,1):
Sum+=a0[i]*a01[i]
print(Sum)



  1. Natural n va m hamda haqiqiy sonli A(1:n,1:m) massiv berilgan. Shu massivning eng katta va eng kichik elementlari joylashgan satrlari o`rinlarini almashtiring.

# Massivni qabul qilish


n = int(input("Massivning qatorlar sonini kiriting: "))
m = int(input("Massivning ustunlar sonini kiriting: "))
A = []
for i in range(n):
row = input().split()
A.append([int(elem) for elem in row])

# Eng katta va eng kichik elementlarni topish


max_row = 0 # eng katta elementlar bo'lgan satr indeksi
min_row = 0 # eng kichik elementlar bo'lgan satr indeksi
max_elem = A[0][0] # massivning eng katta elementi
min_elem = A[0][0] # massivning eng kichik elementi
for i in range(n):
for j in range(m):
if A[i][j] > max_elem:
max_elem = A[i][j]
max_row = i
if A[i][j] < min_elem:
min_elem = A[i][j]
min_row = i

# Satrlar o'rinlarini almashtirish


A[max_row], A[min_row] = A[min_row], A[max_row]

# Natija chiqarish


print("Natija: ")
for i in range(n):
for j in range(m):
print(A[i][j], end=' ')
print()


Download 82.67 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling