View previous topic :: View next topic |
Author |
Message |
SaintMichael57
Joined: 28 Nov 2016 Posts: 14
|
Posted: Sat Jan 27, 2018 6:16 pm Post subject: Formatting a value |
|
|
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. |
|
Back to top |
|
|
simon
Joined: 05 Jul 2006 Posts: 268
|
Posted: Sat Jan 27, 2018 7:37 pm Post subject: |
|
|
Code: | 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 |
|
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Sun Jan 28, 2018 6:38 am Post subject: |
|
|
Write (*, Fmt='(" $",f0.2)') v
You could also search for Business Editing in FTN95.chm |
|
Back to top |
|
|
|