C Program to print Alphabet K in a star pattern

Program

#include<stdio.h>
void main()
{
    int i, j, k, num;
    printf("Enter the number of rows:\t");
    scanf("%d", &num);
    for(i =- num; i <= num; i++)
    {
        k = i;
        if(k < 0)
            k = k * -1;
            for(j = 0; j <= num; j++)
            {
                if(k >= j)
                    printf("* ");
                else
                    printf(" ");
            }
            printf("\n");
    }
}

Output

Enter the number of rows:       5
* * * * * *
* * * * *
* * * *
* * *
* *
*
* *
* * *
* * * *
* * * * *
* * * * * *