Sort the odd numbers x(1), x(3), x(5), x(7), x(9) from lowestto highest. Program
ID: 3612961 • Letter: S
Question
Sort the odd numbers x(1), x(3), x(5), x(7), x(9) from lowestto highest. Program selection sort The FORTRAN file will contain: read x(50), hold, hold1, hold2 data x(1), x(2), x(3), x(4), x(5), x(6), x(7), x(8), x(9),x(10) / 4.9, 4.2, 7.4, 7.8, 2.2, 2.2, 5.8, 5.1, 1.4, 1.7 / Sort the odd numbers x(1), x(3), x(5), x(7), x(9) from lowestto highest. Program selection sort The FORTRAN file will contain: read x(50), hold, hold1, hold2 data x(1), x(2), x(3), x(4), x(5), x(6), x(7), x(8), x(9),x(10) / 4.9, 4.2, 7.4, 7.8, 2.2, 2.2, 5.8, 5.1, 1.4, 1.7 /Explanation / Answer
please rate - thanks implicit none integeri,j realx(10),hold data x(1),x(2), x(3), x(4), x(5), x(6), x(7), x(8), 1 x(9), x(10)/4.9,4.2,7.4,7.8,2.2,2.2,5.8,5.1,1.4,1.7/ write( *,10)(x(i),i=1,10) 10 format('The original array: ',10f5.2) doi=1,8,2 do j=i+2,10,2 if(x(i).gt.x(j))then hold=x(i) x(i)=x(j) x(j)=hold endif end do end do write( *, 20)(x(i),i=1,10,2) 20 format('The reorderedarray: ',10f5.2) stop end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.