myCompiler
English
Deutsch
English
Español
Français
Italiano
日本語
한국어
Nederlands
Polski
Português
Recent
Login
Sign up
Deutsch
English
Español
Français
Italiano
日本語
한국어
Nederlands
Polski
Português
Recent
Login
Sign up
Y
@yashandyash30
Complex root
Fortran
4 years ago
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
Roots of quadratic equation
Fortran
4 years ago
program main implicit none real a,b,c,D,r1,r2 !a=1;b=2;c=4 print*,"quadratic equation:ax^2+bx+c" print*,"enter values of a b & c followed by space " read(*,*) a,b,c D=b**2-4*a*c if(D>0.0) then print*,"there are two distinct real roots"
Complex algebra
Fortran
4 years ago
program main complex z1,z2 real a,b,c,d print*, "type value of a,b,c,d" !a=1; b=2; c=3; d=4 read(*,*) a,b,c,d z1=cmplx(a,b) z2=cmplx(c,d)
Complex addition
Fortran
4 years ago
program main complex z1,z2 real a,b,c,d z1=cmplx(a,b) z2=cmplx(c,d) print*,'type values of a,b,c,d' read(*,*) a,b,c,d print*,"z1+z2=",z1+z2 end program main
Value of pi
Fortran
4 years ago
program main real pi1,pi2 pi1=acos(-1.0) pi2=atan(1.0)*4 print *, 'The value of pi is',pi1 print *, 'The value of pi is',pi2 end program main
If else statement
Fortran
4 years ago
program main implicit none integer a,b print*,'enter the value of a and b followed by space' read(*,*) a,b if (a**2 + b**2>50) then print*,"point(a ,b) lies outside of sphere" else print*,"point(a ,b) lies inside of sphere"
Previous
Next page