fork download
  1. program day_of_week
  2. implicit none
  3. character(len=11)::c_day
  4. integer::i_day
  5. print *,'Enter the day of the week(1-7):'
  6. read *,i_day
  7. select case(i_day)
  8. case(1)
  9. c_day='Sunday'
  10. case(2)
  11. c_day='Monday'
  12. case(3)
  13. c_day='Tuesday'
  14. case(4)
  15. c_day='Wednesday'
  16. case(5)
  17. c_day='Thursday'
  18. case(6)
  19. c_day='Friday'
  20. case(7)
  21. c_day='Saturday'
  22. case default
  23. c_day='Invalid day'
  24. end select
  25. print *,'Day=',c_day
  26. end program
Success #stdin #stdout 0.01s 5312KB
stdin
100
stdout
 Enter the day of the week(1-7):
 Day=Invalid day