fork download
  1. program SimpleHash
  2. implicit none
  3.  
  4. character(len=*), parameter :: str = "202401356佐藤颯"
  5. integer :: i
  6. integer :: hash
  7.  
  8. hash = 0
  9.  
  10. do i = 1, len_trim(str)
  11. hash = hash + ichar(str(i:i))
  12. end do
  13.  
  14. print *, "文字列: ", str
  15. print *, "ハッシュ値: ", hash
  16.  
  17. end program SimpleHash
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
 文字列: 202401356佐藤颯
 ハッシュ値:         2133