CASE

 !Program name: CASE

!Select case construct

character(len=1) :: grade

integer :: mark

Print *, 'Select your grade from A to D: '

Read *, grade

Select case (grade)

    case ('A','a')

      write (*,*) 'Excellent!'

    case ('B','b')

      write (*,*) 'Congratulations'

    case ('C','c')

      write (*,*) 'Well done'

    case ('D','d')

      write (*,*) 'Try again'

    case default

      write (*,*) 'Invalid grade'

End select

Print *, 'Your grade is: ', grade

Print *, 'Select your mark from 0 to 100: '

Read *, mark

Select case (mark)

    case (91:100)

      write (*,*) 'Excellent!'

    case (75:90)

      write (*,*) 'Congratulations'

    case (60:74)

      write (*,*) 'Well done'

    case (:59)

      write (*,*) 'Better try again'

    case default

      write (*,*) 'Invalid mark'

end select

Print *, 'Your mark is: ', mark

stop

end

Comentários

Postagens mais visitadas deste blog

HYDROGEN-RADIAL

HYDROGEN-POTENTIAL

ONE_PART_QHO