Menu
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[])
    {
        printResult(30);

    }


    public static void printResult(int marks)
    {
    }

}

Doubts

Problems

Topic: Ternary Operator In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App