Largest LCM of partitions of a number
I am not sure about the overall algorithm but there are better ways for finding LCM. You should use a different algorithm. Try Euclid's algorithm to find the GCD.
Then calculate result(your LCM) in main() as
result = (lowerbound * upperbound)/gcd(lowerbound upperbound);
The problem with your LCM function is that subtraction isn't the best way for finding the GCD which you are currently doing. It will take too long. Just consider the case of x = 1 and y = 100000. It should be easy to see that number of subtractions is much higher in this case and the program would be very slow.

If you don't want to change the algorithm(which you should) then the least optimization that I can think is to not declare n1 and n2 separately in the function lcm. Just use x and y. Do the final division by the product in the main function. It will at least save you 2 variables.

EDIT
I came up with a much better optimization. In your main loop instead of going from the outside pairs i.e (1, n-1) to the inside pairs you would do much better by going from the inside.
Example

5 = (1,4) and 5 = (2,3). The maximum is found at 5 = (2,3).
7 = (1,6) , 7 = (2,5) and 7 = (3,4). The maximum is at 7 = (3,4).

The answer is in the middle. You'll get it without a loop.
But there is a big problem. This reasoning works only for odd numbers. I tried writing down numbers on paper and solved it by hand. I'll need some more time to find out a pattern for even numbers.
But for odd numbers this is probably the best optimization.
EDIT2
In the main function instead of
if(result &gt;= max) you should be using if(result &gt; max). What is the use of replacing the number with the same number? One less operation.
You don't need to initialize counter at the beginning. You are doing that in the for loop.
EDIT3:
For the case of even numbers the maximum lcm will be either lcm((input/2)-2, (input/2)+2) or lcm((input/2)-1, (input/2)+1). It's easy to find which will be maximum without calculating both of them.
If input/2 is even then lcm((input/2)-1, (input/2)+1) should be maximum otheriwse it should be lcm((input/2)-2, (input/2)+2).

EDIT After OP's Update 1
How about this as a better code
#include&lt;stdio.h&gt;

int main(void)
{
    int input, result;
    printf(&quot;Enter the input = &quot;);
    scanf(&quot;%d&quot;,&amp;input);

    while (input &lt;= 0)
    {
        printf(&quot;Enter a positive non zero number :&quot;);
        scanf(&quot;%d&quot;,&amp;input);
    }

    // (x % 2) used as a condition in C means checking x for odd number
    int middle = input/2;
    result = input % 2  ? (middle % 2 ? middle * middle - 4 : middle * middle - 1)
                        :  middle * (middle + 1);

    printf(&quot;Result = %d&quot;,result);
    return 0;
}

Removed unnecessary braces, spaces, comparisons and comments. Comments are needed but commenting obvious things is just noise. I prefer single space on both sides of operators.