Created
January 4, 2022 19:25
-
-
Save ayeshLK/5178dd6e8906c548b8808cbbabc0f237 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Grade { | |
A, B, C, F | |
} | |
function calculateGrade(int marks) returns Grade { | |
// checks whether the `marks` are greater than or equal to `75` | |
if marks >= 75 { | |
return A; | |
// checks whether the `marks` are less than `75` but greater than or equal to `65` | |
} else if marks >= 65 { | |
return B; | |
// checks whether the `marks` are less than `65` but greater than or equal to `40` | |
} else if marks >= 40 { | |
return C; | |
} else { | |
return F; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment