Two Questions About Fortran:

  • Fortran
  • Thread starter ƒ(x) → ∞
  • Start date
  • Tags
    Fortran
  • #1
Is it possible to loop a set of numbers?

For example I wish to run a set of number 1,2,3,4,5...52 but when we get to 52 I wish to go back to 1 and start looping again.

How do write an output file in Fortran?

I have opened a file and moved each character so that each letter has moved for example d to e...x to y... How could I write this new series of characters to a file
 
  • #2
Not sure what you mean by "run" a set of numbers. If you just wish to print them, then something easy enough like this should work:
Code:
do i=1,n !-- number of times you wish you loop
 do j=1,52
    write(6,*) j
 end do
end do

As far as the second question, you might be best parsing each character in a line, and then concatenating them all to one text string and writing that entire line to file (rather than character by character).
 

Suggested for: Two Questions About Fortran:

2
Replies
60
Views
2K
Replies
12
Views
741
Replies
2
Views
608
Replies
8
Views
776
Replies
4
Views
820
2
Replies
37
Views
2K
Replies
8
Views
2K
Replies
12
Views
1K
Replies
4
Views
951
Back
Top