Fortran第五次作业(不同年龄段个税 计算,闰年判断)

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

program zhangmingsheng
integer*4::age
integer*8::year
real*8::income
real*8::tax
print*,'Question 1:'
write(*,"(/)")
write(*,*)'Please input your income:'
read(*,*)income
write(*,*)'Please input your age:'
read(*,*)age
select case(age)
case(:50)
if(income>=0 .and. income<=1000)then
tax=income*0.03
else if(income>1000 .and. income<=5000)then
tax=income*0.05
else if(income>5000)then
tax=income*0.15
end if
case(51:110)
if(income>=0 .and. income<=1000)then
tax=income*0.5
else if(income>1000 .and. income<=5000)then
tax=income*0.7
else if(income>5000)then
tax=income*0.10
end if
end select
write(*,10) tax
10 FORMAT('The tax is:',F9.2///)
print*,'Question 2:'
write(*,"(/)")
write(*,*)'Please input the year:'
read(*,*)year
if((mod(year,4)==0 .AND. mod(year,100)/=0) .or. mod(year,400)==0)then
write(*,100)year
100 FORMAT('The year of',I5,' is a leap year!'/)
else
write(*,*)'This year is not a leap year!'
write(*,"(/)")
write(*,"(/)")
end if
stop
end


相关文档
最新文档