Question Index

Write a program to print the student result as 'Distinction', 'Pass' and 'Fail' using only the ternary operator.
Note : If the student marks is less than 35 print Fail, if marks are greater than or equal to 60 print Distinction, if marks greater than or equal to 35 and less than 60 print Pass.
Use System.out.println or System.out.print for printing.

Input (Integer) Printed Output
18 Fail
34 Fail
35 Pass
40 Pass
60 Distinction
77 Distinction

class PrintStudentResultUsingTernary
    public static void main(String s[])


    public static void printResult(int marks)




Topic: Ternary Operator In Java

Read this topic
Take test on this topic

Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App