Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 2 3 4 5 6 7

program massive 
integer i, c, z, m1, m2 
integer a(7) 
print*, 'введи массив' 
read*, a 
print*, 'массив:', a 
!m1-максимальный элемент слева 
m1=a(1) 
do i=1,3 
if (a(i).gt.m1) then 
m1=a(i) 
z=i 
end if 
end do 
!m2-максимальный элемент справа 
m2=a(5) 
do i=5,7 
if (a(i).gt.m2) then 
m2=a(i) 
c=i 
end if 
end do 
a(c)=m1 
a(z)=m2 
print*, 'измененный массив:', a 
end program massive

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.