fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. }
Success #stdin #stdout 0.08s 54560KB
stdin
program SimpleHash
    implicit none

    character(len=*), parameter :: student_id = "202401348"
    character(len=*), parameter :: name = "KANE"

    character(len=100) :: data
    integer :: i
    integer(kind=8) :: hash

    data = trim(student_id) // trim(name)

    hash = 0

    do i = 1, len_trim(data)
        hash = mod(hash * 31 + ichar(data(i:i)), 1000000007_8)
    end do

    print *, "Student ID = ", student_id
    print *, "Name       = ", name
    print *, "Hash Value = ", hash

end program SimpleHash
stdout
Standard output is empty