![]() |
VOOZH | about |
Given three numbers A, B, and M. The task is to print the sum of A and B under modulo M.
Examples:
Input: a = 10, b = 20, m = 3
Output: 0
Explanation: (10 + 20) % 3 = 30 % 3 = 0Input: a = 100, b = 13, m = 107
Output: 6
Approach: To solve the problem follow the below idea:
Add the two given numbers A and B and print their sum under modulo M.
Below is the implementation of the above approach:
0
Time complexity: O(1)
Auxiliary Space: O(1)