KnowledgeBoat Logo
|

Computer Applications

Give the output of the following:

int f = 10, m = 9;
String e = (m % f == 9)? "YES": "NO";
System.out.print(e);

Java Operators

2 Likes

Answer

Output
YES
Explanation

1. Initial values: f = 10, m = 9

2. Step-by-step evaluation:

  • m % f: The remainder when 9 is divided by 10 is 9 (9 % 10 == 9).
  • The condition m % f == 9 is true.

3. Ternary operation: Since the condition is true, "YES" is assigned to e.

4. Output: The value of e is "YES", which is printed.

Answered By

1 Like


Related Questions