1.

What will the result of num variable after execution of the following statements? int num = 68; num % = 13;​

Answer»

Answer:

num = 3

Explanation:

Given,

int num = 68; num % = 13;​

To find: What will the result of num variable after EXECUTION

Concept: Modulus(%) operator is USED to store the REMAINDER.

Solution:

int num = 68; num % = 13;​

here first the num variable is initialised as 68.

and, thereafter its SECOND statement can be written as:

num = num%13.

i.e 68%13.

On dividing 68 with 13 we will obtain 5 as quotient and 3 as Remainder.

Since, the '%' operator executes remainder therefore, num will be re-initialsed as 3.

Hence, the result of num variable after execution will be 3.



Discussion

No Comment Found