Which symbol is used for the ‘modulo’ operation in C?
a) +
b) –
c) %
d) /
Answer:
c) %
Explanation:
The modulo operator (%
) in C is used to find the remainder of the division of two integers. For example, 5 % 2
results in 1
, because 5 divided by 2 leaves a remainder of 1. The modulo operator is often used in programming for tasks such as checking divisibility, implementing cyclic behavior, or working with arrays.
Understanding how to use the modulo operator is essential for performing arithmetic operations and controlling program flow in C.