Reduce
is able to solve these types of problems.
To answer the specific case in your comment above:
In[1]:= solns = Reduce[x1 + 2 x2 + 5 x3 + 7 x4 == 40 &&
x1 + x2 + 2 x3 + x4 == 20 &&
x1 > 0 && x2 > 0 && x3 > 0 && x4 > 0,
{x1, x2, x3, x4}, Integers]
Out[1]= (x1 == 6 && x2 == 11 && x3 == 1 && x4 == 1) ||
(x1 == 7 && x2 == 8 && x3 == 2 && x4 == 1) ||
(x1 == 8 && x2 == 5 && x3 == 3 && x4 == 1) ||
(x1 == 9 && x2 == 2 && x3 == 4 && x4 == 1) ||
(x1 == 11 && x2 == 5 && x3 == 1 && x4 == 2) ||
(x1 == 12 && x2 == 2 && x3 == 2 && x4 == 2)
Edit:
You can check that this is the same solution you get by solving the two equations separately and taking the intersection of their solutions:
In[2]:= a = Reduce[x1 + 2 x2 + 5 x3 + 7 x4 == 40 &&
x1 > 0 && x2 > 0 && x3 > 0 && x4 > 0,
{x1, x2, x3, x4}, Integers];
b = Reduce[x1 + x2 + 2 x3 + x4 == 20 &&
x1 > 0 && x2 > 0 && x3 > 0 && x4 > 0,
{x1, x2, x3, x4}, Integers];
In[4]:= solns == Intersection[a, b]
Out[4]= True
And you can extract the solutions by, e.g.,
turning the solutions into a list of replacement rules
and applying to the variables:
In[5]:= {x1, x2, x3, x4} /. {ToRules[solns]}
Out[5]= {{6, 11, 1, 1}, {7, 8, 2, 1}, {8, 5, 3, 1},
{9, 2, 4, 1}, {11, 5, 1, 2}, {12, 2, 2, 2}}