Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran Complex number in fortran 90

  1. May 17, 2015 #1
    i have a a little problem in fortan90 i just wanted to know how to input a complex number ( input real and img part alone ) all i want to do is to make a simple program about DeMoivres Theorem i have been around in google
    all i know how to declare a argument as complex
    complex a
    then how to let the user input the real and img part for argument a
    i did read(*,*)a
    every time it give runtime error :)
    thanks in advance
  2. jcsd
  3. May 17, 2015 #2


    Staff: Mentor

  4. May 17, 2015 #3
    A google search with fortran90 and complex returned quite a few links.

    In any case, if you want to read a complex number straight into variable 'a', for example, as you show above, you need to enter your value as a complex number, i.e., enclosed in parenthesis, in other words, you type, say, "(1.43, 22.3)"
  5. May 17, 2015 #4
    thanks guys for helping specially gsal i used your idea and its works thank a lot n7vc8.jpg
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook