1019. If ElseIf

Given marks of a student, print on the screen:

  • Grade A if marks >= 90
  • Grade B if marks >= 70
  • Grade C if marks >= 50
  • Grade D if marks >= 35
  • Fail, otherwise.

For printing use:-

  • for C++ : cout << variable_name;
  • for Java : System.out.print();
  • for Python : print()
  • for Javascript : console.log()
  • for C# : Console.WriteLine();
  • for Go : fmt.Println()

Example 1:

Input: marks = 95

Output: Grade A

Explanation: marks are greater than or equal to 90.

Example 2:

Input: marks = 14

Output: Fail

Explanation: marks are less than 35.

Now Your Turn!

Pick the correct output for the given input

Input: marks = 70

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 0 <= marks <= 100
0
class Solution {
public:
void studentGrade(int marks) {
 
}
};
Test Case

Input:

Marks