This takes a complex number, and determines what the imaginary part of the number is. For a complex number in the form a+bi, this would return b. imag returns a real number.
real( returns a, the part imag discards.
real(A)+imag(A)i=A would return true.
PROGRAM:IMAG :ClrHome :Input "Value: ",N :imag(N)→>I :If I≠0 :Then :Output(2,1,"THE IMAGINARY") :Output(3,1,"PART IS") :Output(4,1,I) :Pause :Stop :End :If I=0 :Then :Output(2,1,"THE NUMBER HAS") :Output(3,1,"NO IMAGINARY") :Output(4,1,"PART") :Pause :Stop :End
This program will ask the user to input a value. If the number has an imaginary part, it will print the imaginary part. Otherwise, it will print that the number has no imaginary part.