Home > database >  Simple choice structure problems in FORTRAN
Simple choice structure problems in FORTRAN

Time:10-04

Always appear all sorts of mistakes, I have changed, don't know how to check the baidu for a long time, also seek to reassure,
The code below
The program main
Implicit none
Real: : x, y
Read *, x
If (x.G t. - 15. And. X.L t. 0) then y=COS (x)
The else
If (x.G e. 0. And. X.I t. 10) then y=LOG (x * * 2 + 1)
The else
If (x.G t. 15. And. X.I t. 20) then y=x * * (1/3)
Else print *, 'other'
END the IF
Print *, '=' y, y
End

CodePudding user response:

The program main
Implicit none
Real: : x, y
Read *, x
If (x.G t. - 15. And. X.L t. 0) then y=COS (x)
The else
If (x.G e. 0. And. X.L t. 10) then y=LOG (x * * 2 + 1)
The else
If (x.G t. 15. And. X.L t. 20) then y=x * * (1/3)
Else print *, 'other'
END the IF
Print *, '=' y, y
End

There are two letters to lose the wrong, but in addition there are mistakes
  • Related