Printing a text rectangle
Dimensions and looping

It looks like you have some off-by-one errors.  This is not a 1×7 box by any definition that I can think of:

Enter Box dimensions (LxW):1 7
********
*      *
*      *
********


In C, the idiomatic way to write a loop that does something n times is for (int i = 0; i &lt; n; i++) { … }.    (Sometimes, the situation calls for for (int i = 1; i &lt;= n; i++) { … } instead, but that's rarer.)  You start your counters at 0, which is good, but you used &lt;= in your termination conditions, which is weird.

Functions

It's a good habit to make a function for any chunk of code that has an identifiable purpose.  Here, it makes sense to define a void printBox(int length, int width) function.  If you need to modify the program to take command-line parameters instead of keyboard input, then you can still call the same function.

By the way, int long is a bit unconventional.  Unless you have a specific reason to do otherwise, just use int.

Smarter library use

You're basically using printf() where the simpler putchar() function will do.  The vertical lines, though, can be better written using a smarter call to printf().  (Consult the documentation for printf().)

Error checking

Functions like scanf() can fail due to invalid user input.  You should be in the habit of checking the return value.

Suggested solution

#include &lt;stdio.h&gt;

void printBox(int length, int width) {
    // Top
    if (length &gt;= 1) {
        for (int i = 0; i &lt; width; i++) {
            putchar('*');
        }
        putchar('\n');
    }

    // Sides
    for (int i = 0; i &lt; length - 2; i++)
    {
        printf("*%*s\n", width - 1, "*");
    }

    // Bottom
    if (length &gt;= 2) {
        for (int i = 0; i &lt; width; i++) {
            putchar('*');
        }
    }
    putchar('\n');
}

int main(void)
{   
    int length, width;
    printf("Enter Box dimensions (LxW):");
    if (2 != scanf("%d %d", &amp;length, &amp;width)) {
        // Indicate input error
        return 1;
    }
    printBox(length, width);
}