[Fortran] 纯文本查看 复制代码
program ex0524
implicit none
integer age
real pay,tax
write(*,*)"Your age?"
read(*,"(I3)")age
write(*,*)"Pay?"
read(*,*)pay
select case(age)
case(0:49)
if(pay>=5000)then
tax=pay*0.15
else if(pay>=1000)then
tax=pay*0.1
else if(pay>=0)then
tax=pay*0.03
else
write(*,*)"WRONG PAY!!!"
stop
end if
case(50:)
if(pay>=5000)then
tax=pay*0.1
else if(pay>=1000)then
tax=pay*0.07
else if(pay>=0)then
tax=pay*0.05
else
write(*,*)"WRONG PAY!!!"
stop
end if
case default
write(*,*)"WRONG AGE!!!"
stop
end case
write(*,*)"Your tax is",tax
read(*,*)
end