输入一个小写字母d,将其转换为大写字输出,怎样用fortran95语言编写程序

2025-01-07 06:21:53
推荐回答(2个)
回答1:

program main
implicit none
character*20 str
integer i
print*,'input the string:'
read*,str
do i=1,len_trim(str)
if(str(i:i)>='a'.and.str(i:i)<='z') str(i:i)=char(ichar(str(i:i))-32)
end do
print*,’the inverted string:’
print*,str
end

回答2:

按shift和Caps Lock就行了