Silverfrost Forums

Welcome to our forums

Formatting a value

27 Jan 2018 5:16 #21241

Dear Silverfrost Community: Can someone format a numerical value so that it is in the form of the U.S. currency (dollars and cents)? Thank you. 😃

27 Jan 2018 6:37 #21243
Program dollars_cents
Character(Len=16) :: c
Real :: v

Read (Unit=*, Fmt=*) v
Write (Unit=c, Fmt='(F16.2)') v
c = '$' // Adjustl(c)
Print *, c
End Program dollars_cents
28 Jan 2018 5:38 #21247

Write (*, Fmt='(' $',f0.2)') v

You could also search for Business Editing in FTN95.chm

Please login to reply.