Reputation: 658
I have a double precision variable x = 10, and when I use the statement: Print(,) x Fortran will print out a lengthy number as 10.0000000000000 . I only want 2 digits after the decimal point (.), that is 10.00 what should I do , instead of using Print(,) ? Thank you all in advance.
Upvotes: 0
Views: 7545
Reputation: 130
X=10
WRITE(*,44) X
44 FORMAT(F4.2)
I think the FORMAT statement is what you're after. The F4.2 says to write a real in 4 columns with 2 digits after the decimal.
Upvotes: 3