Skip to main content

Subtract Without Subtract

Problem Description​

Create a function that subtracts one positive integer from another without using the - operator.

Input​

  • Two positive integers:
    1. subtract: The integer to subtract.
    2. from: The integer from which to subtract.

Output​

  • A single integer representing the result of the subtraction.

Constraints​

  • Both input integers will be positive.

Example​

Input:
subtract: 5, from: 9

Output:
4

Explanation:
The result of subtracting 5 from 9 is 4.

Input:
subtract: 10, from: 30

Output:
20

Explanation:
The result of subtracting 10 from 30 is 20.