QUICK FORTRAN QUESTION

Kenji4861

Banned
Jan 28, 2001
2,821
0
0
I just want to know how to output everything onto one line.

do 100 i=1, 10
write (*,*) i
100 continue

If I do this, it outputs as
1
2
3
4
5
6
7
8
9
10

How can I make it so, it'll go
1 2 3 4 5 6 7 8 9 10
 

Abzstrak

Platinum Member
Mar 11, 2000
2,450
0
0
Its been a REALLY long time, so I may be wrong, but it was either fortran or basic where if U put a ; at the end of the line it'll skip the CR.

if it doesn't work lemme know, I think I still have a fortran book somewhere.
 

rgwalt

Diamond Member
Apr 22, 2000
7,393
0
0
Use an implied do loop

Write(*,*) (i, i=1,10)

And you'll probably need to use a format specifier, but you can figure that out pretty easily.

Ryan
 

NucEm

Senior member
Jun 13, 2001
242
0
76
One way is:

Do 100 i=1,10
Write (6,150) i
150 Format (I3,$)
100 continue
Write (6,*)

There are other ways too.