How to swap number in the fortran memory?

  • Topic: Fortran 
  • Thread starter Thread starter dadidudada
  • Start date Start date
  • Tags Tags
    Fortran Memory
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
4 replies · 6K views
dadidudada
Messages
6
Reaction score
0
how to swap number in the fortran memory??

hello..
im new to fortran so how i swap number in do loop
first the tracing is like this:

x(1)=3
x(2)=8

then, how to i can swap the number in x(1) and x(2)

can anyone help me
please...
 
Physics news on Phys.org


ok I am completely blank..
if i have to arrange these number(10,4,1)into ascending order..
what should i do..
 
Last edited:


Run through each number (to n-1) in the list (of n numbers) and swap over any where x(a) > x(a+1). Repeat. Set up a flag so you can stop if none are swapped during a repeat.
 


cmb said:
Run through each number (to n-1) in the list (of n numbers) and swap over any where x(a) > x(a+1). Repeat. Set up a flag so you can stop if none are swapped during a repeat.

thanks man!its solved..
credit to cmb...