Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fortran code to convert chars to uppercase.
! 英小文字->英大文字 変換
! : 入力文字列の英小文字を全て英大文字に変換して出力する
! date name version
! 2017.05.14 1.00 新規作成
! Copyright(C) 2017 All Rights Reserved.
program to_uppercase
implicit none
integer i
character(len=100) line
print *, "英文を入力してください(100文字超は切り捨て):"
read '(a)', line
do i = 1, len_trim(line)
if (line(i:i) >= 'a' .and. line(i:i) <= 'z') then
line(i:i) = char(ichar(line(i:i)) - 32)
end if
end do
print '(a)', trim(line)
end program to_uppercase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.