0

I'm trying out Fortran, and when I run my code

program main
implicit none
  integer :: somevar
  somevar = 5
  print*,"why is there so much spacing between this and",somevar
end program main

It gives such output:

$ gfortran main.f90 -o main && ./main
 why is there so much spacing between this and           5

I found this: How to get rid of unwanted spacing in Fortran's print output? But I tried to implement the answer, and it didn't work.

How do you fix this spacing problem?

Karma
  • 9
  • 1
  • 1
    If you are struggling with implementing the explicit formats required, then please ask about, and show, your attempts. Otherwise it's hard to see why the question you link doesn't meet your requirements. – francescalus Feb 18 '21 at 19:08
  • *"But I tried to implement the answer, and it didn't work."* - ask about your attempts then. Be specific and show what exactly happened. The complete code, the output, the error messages. See [ask]. – Vladimir F Героям слава Feb 18 '21 at 20:01

0 Answers0