program main
real a
complex b
b=(-4,0)
a=-4
!! writing cmplx(a) is equivalent to writing a=(-4,0)
print *, sqrt(cmplx(a))
!!if you write it directly
print*,sqrt(a)
!! it wont work bcz here range of sqrt is real
print*,sqrt(b)
!!it is working in these two cases bcz it's range contains all complex number
end program main
To embed this project on your website, copy the following code and paste it into your website's HTML: