I have come across this question: In order to pass a certain unit, a student has to get a mark of at least 50 in the totalMark . Set the variable grade to either “Pass” or “Fail” according to this rule. Complete the following code using only a single if … WITHOUT else statement and print the results. (write the if statement and print the result only)
What code would I add after this?
Scanner dataInput = new Scanner(System.in); System.out.println("Enter the total mark: "); int totalMark = dataInput.nextInt(); String grade = "Pass";