Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How to take user input in fortran? I knpw that we use 'read ' function , but here it is not working.

+5 votes
asked Apr 11, 2023 by Jahnvi Mistry (170 points)

1 Answer

0 votes
answered May 2, 2023 by Peter Minarik (86,240 points)
edited May 3, 2023 by Peter Minarik

This should help: https://www.tutorialspoint.com/fortran/fortran_basic_input_output.htm

I've also made a small program that can read someone's name (spaces not allowed) and print it out:

Program Hello
character (len = 20) :: name
print *, 'What is your name?'
read *, name
print *, 'Hello, ', trim(name), '!' !trim() is used to remove any trailing space after the useful part of the name
End Program Hello

If you still have trouble, please share your code.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...