Yursunov Dilyorbek 23 – variant
Topshiriq.
Berilgan matrisaning musbat elementlari o`rniga 1 qo`yish orqali yangi matrisani shakllantiring.
1 – misol. Berilgan matritsa : A=[1 -2 4; -3 3 6; 8 -4 -5;] 3x3 matritsa.
Dastur kodi
A=[1 -2 4; -3 3 6; 8 -4 -5;]
for i=1:3
for j=1:3
if A(i,j)>=0
A(i,j)=1
end
end
end
Natija:
Dastur natijasi:
2 – misol. Berilgan matritsa: A=[-3 7 -6; 2 -5 4; 6 -4 9;]
Dastur kodi :
A=[-3 7 -6; 2 -5 4; 6 -4 9;]
for i=1:3
for j=1:3
if A(i,j)>=0
A(i,j)=1
end
end
end
Natijasi:
Dastur natijasi :
Do'stlaringiz bilan baham: |