FUNCTION
subtract
Performs the subtraction of two long positive integers in the given base.
Interface
#include <codecogs/maths/combinatorics/arithmetic/subtract.h>
using namespace Maths::Combinatorics::Arithmetic;
This function calculates the subtraction of two long <em> positive </em> integers stored as character strings, in the given numerical base. The maximum number of digits of either of the numbers is only limited by the amount of memory available.
Example 1
#include <codecogs/maths/arithmetic/subtract.h>
#include <iostream>
int main()
{
std::string a("232342353"), b("73452344"),
c = Maths::Arithmetic::subtract(a, b, 8);
std::cout << "The following is a base 8 operation" << std::endl;
std::cout << a << " - " << b << " = " << c << std::endl;
return 0;
}Output:
The following is a base 8 operation
232342353 - 73452344 = 136670007Parameters
a
the first number
b
the second number
base
Default value = 10
Returns
a character string corresponding to the difference of the given numbers
The first number needs to be greater than the second, otherwise the function will exit.
Interactive Calculator
a
b
base
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.