好的
[Fortran] 纯文本查看 复制代码 program test0503
implicit none
integer age
real income,tax
write(*,*) "Input your age:"
read(*,*) age
write(*,*) "Input your income:"
read(*,*) income
select case(age)
case(0:49)
if(income>=0.0.and.income<=1000.0) then
tax=income*0.03
else if(income>1000.0.and.income<=5000.0) then
tax=income*0.10
else if(income>5000.0) then
tax=income*0.15
else if(income<0.0) tax=0
end if
case(50:)
if(income>=0.0.and.income<=1000.0) tax=income*0.05
if(income>1000.0.and.income<=5000.0) tax=income*0.07
if(income>5000.0) tax=income*0.10
if(income<0.0) tax=0
case default
tax=0
end select
write(*,*) "Tax:"
write(*,*) tax
stop
end |