KnowledgeBoat Logo
|

Computer Applications

Write the value of n after execution:

char ch ='d';
int n = ch + 5;	

Values & Data Types Java

ICSE 2023

28 Likes

Answer

The value of n is 105.

Explanation

  1. char ch = 'd'; assigns the character 'd' to the variable ch. In ASCII, the character 'd' has a decimal value of 100.
  2. int n = ch + 5; adds 5 to the ASCII value of 'd', which is 100. So, 100 + 5 equals 105.

Therefore, the value of n will be 105.

Answered By

17 Likes


Related Questions