Site icon Exam4Training

What is the result of the following expression in C: int num1 = 10; int num2 = 3; int result = num1 / num2;

What is the result of the following expression in C: int num1 = 10; int num2 = 3; int result = num1 / num2;
A . 3.33
B . 4
C . 2.33
D . 3

Answer: D

Explanation:

Integer division in C truncates the decimal part, so the result of num1 / num2 would be 3.

Exit mobile version