if (a>b&&b>c) then largest number is:

ICSE Class 10 Computer Applications PYQ · 2024 Paper · Section A

1(vii)1 Mark · 2024 · Section A · 2024 Paper

if (a>b&&b>c) then largest number is:

Show SolutionHide Solution↓

a

Reason — The && (Logical AND) operator in Java is used to combine two boolean expressions. It returns true only if both expressions are true. If either of the expressions is false, the entire condition becomes false.

The condition if (a > b && b > c) checks two expressions:

  1. a > b – Checks if a is greater than b.
  2. b > c – Checks if b is greater than c.

Since both conditions must be true (due to the && operator), the logical sequence becomes:
a > b > c

In this sequence:
a is the largest number because it is greater than both b and c.

← Previous questionNext question →

Share on WhatsApp

Browse the free Computer Applications sample bank