Get Minimum of four and maximum up to a limit
First impressions

Obviously, the code needs to be indented properly.  (Is that really how you wrote the code, or an artifact of the posting process?  The easiest way to post code on Stack Exchange is to paste it, select it all, and hit CtrlK on the entire block.)  In addition, you need to pick a consistent brace style.  (Your if-statements use K&amp;R braces, but the function definition and the for-loops use a different convention.)

Don't omit "optional" braces:


if((sum-a[0])&lt;=x)
big = sum-a[0];
else if((sum-a[1])&lt;=x)
big = sum-a[1];
else if((sum-a[2])&lt;=x)
big = sum-a[2];
else
big = small;



By omitting braces, someday, you will contribute to a coding mishap, and it will be your fault.  (If you use K&amp;R braces, the braces will hardly take up any extra space.)

In modern C, you should avoid overwhelming declarations like this:


int x,a[4],i,j,n,temp,big,small,sum=0;



I have no idea what these variables are, or where they will be significant.  Since the challenge used terminology r and x, I would use those names instead of making up new ones.

Validation and output

Near the end, you wrote:


if(big == small){
    return 0;
}



That check doesn't make much sense to me.  First of all, the specification calls for two numbers to be output.  You shouldn't decide to omit one of them.  (Note that if big is over budget, then so is small.)  In the absence of any guidance on how to handle these special cases, I wouldn't bother checking for these conditions, except perhaps to write a comment or assertion.

Algorithm

The messiest part of the program is this bubble-sort-and-sum loop:


for(i=0;i&lt;n;i++)
{
    for(j=i;j&lt;(n);j++)
    {
        if(a[i]&gt;a[j]){
            temp = a[i];
            a[i] = a[j];
            a[j] = temp;
        }
    }
    sum+=a[i];
}



I don't think that sorting is necessary to solve this challenge, but if it were, I would recommend writing a function to do sorting.

Suggested solution

#include &lt;stdio.h&gt;

int sum(int a[], size_t len) {
    …
}

int max(int a[], size_t len) {
    …
}

int main() {
    // Read input r1, r2, r3, r4, and x.  Note that r[0] holds r1.
    int r[4], x;
    for (int i = 0; i &lt; sizeof(r) / sizeof(r[0]); i++) {
        if (!scanf("%d", &amp;r[i])) return 1;
    }
    if (!scanf("%d", &amp;x)) return 1;

    // Sum of all four
    int total = sum(r, sizeof(r) / sizeof(r[0]));

    // Sum of three smallest r (assumed to be within budget)
    int least = total - max(r, sizeof(r) / sizeof(r[0]));

    int most = least;
    for (int i = 0; i &lt; 4; i++) {
        int other_sum = total - r[i];
        if (most &lt; other_sum &amp;&amp; other_sum &lt;= x) {
            most = other_sum;
        }
    }
    printf("%d %d\n", least, most);
}