- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Need to print two column of numbers (integers) with same width, with 1st column left aligned and 2nd column right aligned. Can someone help me?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Something like :
character(widthRequired) leftString integer firstNumber integer secondNumber write(leftString, *) firstNumber leftString = adjustl(leftString) write(outputfile,fmt) leftString, secondNumber
where fmt is say (A10, I10) and "10" is the widthRequired.
Hope this helps but you should look up ADJUSTL (and maybe ADJUSTR) in the help
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Les!
I was trying out only with numbers and the string conversion worked for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or,
Write (outputfile,'(I0,T10,I10) n1,n2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
nvaneck wrote:
Or,
Write (outputfile,'(I0,T10,I10) n1,n2
I had totally forgotten about format i0 I spend most of my life in C# now. Punishment but I don't know what I did wrong. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
nvaneck wrote:
Or,
Write (outputfile,'(I0,T10,I10) n1,n2
Most simplest form. Thank you!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page