Star Patterns Program in C

Certainly! Here’s an example of a program written in C to print star patterns:

#include <stdio.h>

// Function to print a pattern of stars
void printPattern(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in decreasing order
        for (j = n; j > i; j--) {
            printf(" ");
        }

        // Print stars in increasing order
        for (j = 1; j <= i; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int rows;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);

    printf("Pattern:\n");
    printPattern(rows);

    return 0;
}

In this program, we have a function printPattern that takes an integer n as input and prints a pattern of stars. The printPattern function uses two nested loops to control the number of spaces and stars to be printed on each row. The main function prompts the user to enter the number of rows and then calls the printPattern function to print the pattern.

Here’s an example output for n = 5:

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

You can modify the program to print different patterns by adjusting the logic inside the printPattern function.

Square Star Pattern:

Certainly! Here’s an example of a program in C that prints a square star pattern:

#include <stdio.h>

// Function to print a square star pattern
void printSquare(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print stars in each column
        for (j = 1; j <= n; j++) {
            printf("* ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the square: ");
    scanf("%d", &size);

    printf("Square Star Pattern:\n");
    printSquare(size);

    return 0;
}

In this program, we have a function printSquare that takes an integer n as input and prints a square star pattern. The printSquare function uses two nested loops to print stars in each row and column of the square. The main function prompts the user to enter the size of the square and then calls the printSquare function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the square: 5
Square Star Pattern:
* * * * * 
* * * * * 
* * * * * 
* * * * * 
* * * * *

The size of the square determines the number of rows and columns, and the stars are printed in each row and column to form the square pattern.

Hollow Square Star Pattern:

Certainly! Here’s an example of a program in C that prints a hollow square star pattern:

#include <stdio.h>

// Function to print a hollow square star pattern
void printHollowSquare(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print stars for the first and last row
        if (i == 1 || i == n) {
            for (j = 1; j <= n; j++) {
                printf("* ");
            }
        }
        // Print stars and spaces for the remaining rows
        else {
            for (j = 1; j <= n; j++) {
                if (j == 1 || j == n) {
                    printf("* ");
                } else {
                    printf("  ");
                }
            }
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the square: ");
    scanf("%d", &size);

    printf("Hollow Square Star Pattern:\n");
    printHollowSquare(size);

    return 0;
}

In this program, we have a function printHollowSquare that takes an integer n as input and prints a hollow square star pattern. The printHollowSquare function uses two nested loops to print stars and spaces in each row and column of the square. The conditionals are used to determine whether to print a star or a space based on the row and column position.

Here’s an example output for size = 5:

Enter the size of the square: 5
Hollow Square Star Pattern:
* * * * * 
*       * 
*       * 
*       * 
* * * * *

The size of the square determines the number of rows and columns, and the stars are printed for the first and last row, as well as the first and last column. The remaining positions are filled with spaces to form the hollow square pattern.

Hollow Square Pattern with Diagonal:

Certainly! Here’s an example of a program in C that prints a hollow square pattern with a diagonal:

#include <stdio.h>

// Function to print a hollow square pattern with a diagonal
void printHollowSquareWithDiagonal(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print stars for the first and last row
        if (i == 1 || i == n) {
            for (j = 1; j <= n; j++) {
                printf("* ");
            }
        }
        // Print stars and spaces for the remaining rows
        else {
            for (j = 1; j <= n; j++) {
                if (j == 1 || j == n || j == i) {
                    printf("* ");
                } else {
                    printf("  ");
                }
            }
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the square: ");
    scanf("%d", &size);

    printf("Hollow Square Pattern with Diagonal:\n");
    printHollowSquareWithDiagonal(size);

    return 0;
}

In this program, we have a function printHollowSquareWithDiagonal that takes an integer n as input and prints a hollow square pattern with a diagonal. The printHollowSquareWithDiagonal function uses two nested loops to print stars and spaces in each row and column of the square. The conditionals are used to determine whether to print a star or a space based on the row and column position. Additionally, j == i condition is added to print the diagonal stars.

Here’s an example output for size = 5:

Enter the size of the square: 5
Hollow Square Pattern with Diagonal:
* * * * * 
* *     * 
*   *   * 
*     * * 
* * * * *

The size of the square determines the number of rows and columns. The stars are printed for the first and last row, as well as the first and last column. The diagonal positions are also filled with stars. The remaining positions are filled with spaces to form the hollow square pattern with a diagonal.

Rhombus Star Pattern:

Certainly! Here’s an example of a program in C that prints a rhombus star pattern:

#include <stdio.h>

// Function to print a rhombus star pattern
void printRhombus(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in decreasing order
        for (j = 1; j <= n - i; j++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= n; j++) {
            printf("* ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the rhombus: ");
    scanf("%d", &size);

    printf("Rhombus Star Pattern:\n");
    printRhombus(size);

    return 0;
}

In this program, we have a function printRhombus that takes an integer n as input and prints a rhombus star pattern. The printRhombus function uses two nested loops to print spaces and stars in each row. The first loop is responsible for printing the spaces in decreasing order, and the second loop prints the stars in each row. The main function prompts the user to enter the size of the rhombus and then calls the printRhombus function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the rhombus: 5
Rhombus Star Pattern:
    * * * * * 
    * * * * * 
    * * * * * 
    * * * * * 
    * * * * * 

The size of the rhombus determines the number of rows and columns, and the stars are printed in each row to form the rhombus pattern. The spaces are printed before the stars to create the shape of the rhombus.

Hollow Rhombus Star Pattern:

Certainly! Here’s an example of a program in C that prints a hollow rhombus star pattern:

#include <stdio.h>

// Function to print a hollow rhombus star pattern
void printHollowRhombus(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in decreasing order
        for (j = 1; j <= n - i; j++) {
            printf(" ");
        }

        // Print stars for the first and last row
        if (i == 1 || i == n) {
            for (j = 1; j <= n; j++) {
                printf("* ");
            }
        }
        // Print stars and spaces for the remaining rows
        else {
            for (j = 1; j <= n; j++) {
                if (j == 1 || j == n) {
                    printf("* ");
                } else {
                    printf("  ");
                }
            }
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the rhombus: ");
    scanf("%d", &size);

    printf("Hollow Rhombus Star Pattern:\n");
    printHollowRhombus(size);

    return 0;
}

In this program, we have a function printHollowRhombus that takes an integer n as input and prints a hollow rhombus star pattern. The printHollowRhombus function uses two nested loops to print spaces, stars, and spaces in each row. The first loop is responsible for printing the spaces in decreasing order. The conditionals inside the loop are used to determine whether to print a star or a space based on the row and column position. The main function prompts the user to enter the size of the rhombus and then calls the printHollowRhombus function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the rhombus: 5
Hollow Rhombus Star Pattern:
    * * * * * 
   *       * 
  *       * 
 *       * 
* * * * * 

The size of the rhombus determines the number of rows and columns. The stars are printed for the first and last row, as well as the first and last column. The remaining positions are filled with spaces to form the hollow rhombus pattern.

Mirrored Rhombus Star Pattern:

Certainly! Here’s an example of a program in C that prints a mirrored rhombus star pattern:

#include <stdio.h>

// Function to print a mirrored rhombus star pattern
void printMirroredRhombus(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in increasing order
        for (j = 1; j < i; j++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= n; j++) {
            printf("* ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the mirrored rhombus: ");
    scanf("%d", &size);

    printf("Mirrored Rhombus Star Pattern:\n");
    printMirroredRhombus(size);

    return 0;
}

In this program, we have a function printMirroredRhombus that takes an integer n as input and prints a mirrored rhombus star pattern. The printMirroredRhombus function uses two nested loops to print spaces and stars in each row. The first loop is responsible for printing the spaces in increasing order, and the second loop prints the stars in each row. The main function prompts the user to enter the size of the mirrored rhombus and then calls the printMirroredRhombus function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the mirrored rhombus: 5
Mirrored Rhombus Star Pattern:
* * * * * 
 * * * * * 
  * * * * * 
   * * * * * 
    * * * * * 

The size of the mirrored rhombus determines the number of rows and columns, and the stars are printed in each row to form the mirrored rhombus pattern. The spaces are printed before the stars to create the mirrored effect.

Hollow Mirrored Rhombus Star Pattern:

Certainly! Here’s an example of a program in C that prints a hollow mirrored rhombus star pattern:

#include <stdio.h>

// Function to print a hollow mirrored rhombus star pattern
void printHollowMirroredRhombus(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in increasing order
        for (j = 1; j < i; j++) {
            printf(" ");
        }

        // Print stars for the first and last row
        if (i == 1 || i == n) {
            for (j = 1; j <= n; j++) {
                printf("* ");
            }
        }
        // Print stars and spaces for the remaining rows
        else {
            for (j = 1; j <= n; j++) {
                if (j == 1 || j == n) {
                    printf("* ");
                } else {
                    printf("  ");
                }
            }
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the hollow mirrored rhombus: ");
    scanf("%d", &size);

    printf("Hollow Mirrored Rhombus Star Pattern:\n");
    printHollowMirroredRhombus(size);

    return 0;
}

In this program, we have a function printHollowMirroredRhombus that takes an integer n as input and prints a hollow mirrored rhombus star pattern. The printHollowMirroredRhombus function uses two nested loops to print spaces, stars, and spaces in each row. The first loop is responsible for printing the spaces in increasing order. The conditionals inside the loop are used to determine whether to print a star or a space based on the row and column position. The main function prompts the user to enter the size of the hollow mirrored rhombus and then calls the printHollowMirroredRhombus function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the hollow mirrored rhombus: 5
Hollow Mirrored Rhombus Star Pattern:
* * * * * 
 *       * 
  *     * 
   *   * 
    * * 

The size of the hollow mirrored rhombus determines the number of rows and columns. The stars are printed for the first and last row, as well as the first and last column. The remaining positions are filled with spaces to form the hollow mirrored rhombus pattern.

Right Triangle Star Pattern:

Certainly! Here’s an example of a program in C that prints a right triangle star pattern:

#include <stdio.h>

// Function to print a right triangle star pattern
void printRightTriangle(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print stars in each row
        for (j = 1; j <= i; j++) {
            printf("* ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the right triangle: ");
    scanf("%d", &size);

    printf("Right Triangle Star Pattern:\n");
    printRightTriangle(size);

    return 0;
}

In this program, we have a function printRightTriangle that takes an integer n as input and prints a right triangle star pattern. The printRightTriangle function uses two nested loops to print stars in each row. The first loop determines the number of rows, and the second loop prints the stars based on the row number. The main function prompts the user to enter the size of the right triangle and then calls the printRightTriangle function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the right triangle: 5
Right Triangle Star Pattern:
* 
* * 
* * * 
* * * * 
* * * * *

The size of the right triangle determines the number of rows, and the stars are printed in each row to form the right triangle pattern. The number of stars in each row increases from top to bottom.

Hollow Right Triangle Star Pattern:

Certainly! Here’s an example of a program in C that prints a hollow right triangle star pattern:

#include <stdio.h>

// Function to print a hollow right triangle star pattern
void printHollowRightTriangle(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print stars and spaces in each row
        for (j = 1; j <= i; j++) {
            if (j == 1 || j == i || i == n)
                printf("* ");
            else
                printf("  ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the hollow right triangle: ");
    scanf("%d", &size);

    printf("Hollow Right Triangle Star Pattern:\n");
    printHollowRightTriangle(size);

    return 0;
}

In this program, we have a function printHollowRightTriangle that takes an integer n as input and prints a hollow right triangle star pattern. The printHollowRightTriangle function uses two nested loops to print stars and spaces in each row. The conditionals inside the loop are used to determine whether to print a star or a space based on the row and column position. The main function prompts the user to enter the size of the hollow right triangle and then calls the printHollowRightTriangle function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the hollow right triangle: 5
Hollow Right Triangle Star Pattern:
* 
* * 
*   * 
*     * 
* * * * *

The size of the hollow right triangle determines the number of rows, and the stars are printed in the shape of a right triangle. The first and last column positions, as well as the last row, are filled with stars. The remaining positions are filled with spaces to form the hollow right triangle pattern.

Mirrored Right Triangle Star Pattern:

Certainly! Here’s an example of a program in C that prints a mirrored right triangle star pattern:

#include <stdio.h>

// Function to print a mirrored right triangle star pattern
void printMirroredRightTriangle(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in each row
        for (j = 1; j <= n - i; j++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= i; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the mirrored right triangle: ");
    scanf("%d", &size);

    printf("Mirrored Right Triangle Star Pattern:\n");
    printMirroredRightTriangle(size);

    return 0;
}

In this program, we have a function printMirroredRightTriangle that takes an integer n as input and prints a mirrored right triangle star pattern. The printMirroredRightTriangle function uses two nested loops to print spaces and stars in each row. The first loop is responsible for printing the spaces in each row, which are decreasing as the rows increase. The second loop prints the stars in each row, and the number of stars is increasing as the rows increase. The main function prompts the user to enter the size of the mirrored right triangle and then calls the printMirroredRightTriangle function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the mirrored right triangle: 5
Mirrored Right Triangle Star Pattern:
    *
   **
  ***
 ****
*****

The size of the mirrored right triangle determines the number of rows and columns, and the stars are printed in the shape of a right triangle. The spaces are printed before the stars to create the mirrored effect, and the number of stars in each row increases from top to bottom.

Hollow Mirrored Right Triangle Star Pattern:

Certainly! Here’s an example of a program in C that prints a hollow mirrored right triangle star pattern:

#include <stdio.h>

// Function to print a hollow mirrored right triangle star pattern
void printHollowMirroredRightTriangle(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in each row
        for (j = 1; j <= n - i; j++) {
            printf(" ");
        }

        // Print stars and spaces in each row
        for (j = 1; j <= i; j++) {
            if (j == 1 || j == i || i == n)
                printf("*");
            else
                printf(" ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the hollow mirrored right triangle: ");
    scanf("%d", &size);

    printf("Hollow Mirrored Right Triangle Star Pattern:\n");
    printHollowMirroredRightTriangle(size);

    return 0;
}

In this program, we have a function printHollowMirroredRightTriangle that takes an integer n as input and prints a hollow mirrored right triangle star pattern. The printHollowMirroredRightTriangle function uses two nested loops to print spaces, stars, and spaces in each row. The first loop is responsible for printing the spaces in each row, which are decreasing as the rows increase. The second loop is used to print stars and spaces based on the row and column position. If the column position is the first or last column or if the row is the last row, a star is printed. Otherwise, a space is printed. The main function prompts the user to enter the size of the hollow mirrored right triangle and then calls the printHollowMirroredRightTriangle function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the hollow mirrored right triangle: 5
Hollow Mirrored Right Triangle Star Pattern:
    *
   * *
  *   *
 *     *
*********

The size of the hollow mirrored right triangle determines the number of rows and columns. The spaces are printed before the stars to create the mirrored effect. The first and last columns, as well as the last row, are filled with stars. The remaining positions are filled with spaces to form the hollow mirrored right triangle pattern.

Inverted Right Triangle Star Pattern:

Certainly! Here’s an example of a program in C that prints an inverted right triangle star pattern:

#include <stdio.h>

// Function to print an inverted right triangle star pattern
void printInvertedRightTriangle(int n) {
    int i, j;

    // Iterate for each row
    for (i = n; i >= 1; i--) {
        // Print stars in each row
        for (j = 1; j <= i; j++) {
            printf("* ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the inverted right triangle: ");
    scanf("%d", &size);

    printf("Inverted Right Triangle Star Pattern:\n");
    printInvertedRightTriangle(size);

    return 0;
}

In this program, we have a function printInvertedRightTriangle that takes an integer n as input and prints an inverted right triangle star pattern. The printInvertedRightTriangle function uses two nested loops to print stars in each row. The first loop determines the number of rows, and the second loop prints the stars based on the row number. The main function prompts the user to enter the size of the inverted right triangle and then calls the printInvertedRightTriangle function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the inverted right triangle: 5
Inverted Right Triangle Star Pattern:
* * * * *
* * * *
* * *
* *
*

The size of the inverted right triangle determines the number of rows, and the stars are printed in each row to form the inverted right triangle pattern. The number of stars in each row decreases from top to bottom.

Hollow Inverted Right Triangle Star Pattern:

Certainly! Here’s an example of a program in C that prints a hollow inverted right triangle star pattern:

#include <stdio.h>

// Function to print a hollow inverted right triangle star pattern
void printHollowInvertedRightTriangle(int n) {
    int i, j;

    // Iterate for each row
    for (i = n; i >= 1; i--) {
        // Print stars and spaces in each row
        for (j = 1; j <= i; j++) {
            if (j == 1 || j == i || i == n)
                printf("* ");
            else
                printf("  ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the hollow inverted right triangle: ");
    scanf("%d", &size);

    printf("Hollow Inverted Right Triangle Star Pattern:\n");
    printHollowInvertedRightTriangle(size);

    return 0;
}

In this program, we have a function printHollowInvertedRightTriangle that takes an integer n as input and prints a hollow inverted right triangle star pattern. The printHollowInvertedRightTriangle function uses two nested loops to print stars and spaces in each row. The conditionals inside the loop are used to determine whether to print a star or a space based on the row and column position. If the column position is the first or last column or if the row is the first row, a star is printed. Otherwise, two spaces are printed to create the hollow effect. The main function prompts the user to enter the size of the hollow inverted right triangle and then calls the printHollowInvertedRightTriangle function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the hollow inverted right triangle: 5
Hollow Inverted Right Triangle Star Pattern:
* * * * * 
*       *
*     *
*   *
* *

The size of the hollow inverted right triangle determines the number of rows, and the stars are printed in the shape of an inverted right triangle. The first and last columns, as well as the first row, are filled with stars. The remaining positions are filled with spaces to form the hollow inverted right triangle pattern.

Inverted Mirrored Right Triangle Star Pattern:

Certainly! Here’s an example of a program in C that prints an inverted mirrored right triangle star pattern:

#include <stdio.h>

// Function to print an inverted mirrored right triangle star pattern
void printInvertedMirroredRightTriangle(int n) {
    int i, j;

    // Iterate for each row
    for (i = n; i >= 1; i--) {
        // Print spaces in each row
        for (j = 1; j <= n - i; j++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= i; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the inverted mirrored right triangle: ");
    scanf("%d", &size);

    printf("Inverted Mirrored Right Triangle Star Pattern:\n");
    printInvertedMirroredRightTriangle(size);

    return 0;
}

In this program, we have a function printInvertedMirroredRightTriangle that takes an integer n as input and prints an inverted mirrored right triangle star pattern. The printInvertedMirroredRightTriangle function uses two nested loops to print spaces and stars in each row. The first loop is responsible for printing the spaces in each row, which are increasing as the rows decrease. The second loop is used to print the stars in each row, and the number of stars is decreasing as the rows decrease. The main function prompts the user to enter the size of the inverted mirrored right triangle and then calls the printInvertedMirroredRightTriangle function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the inverted mirrored right triangle: 5
Inverted Mirrored Right Triangle Star Pattern:
*****
 ****
  ***
   **
    *

The size of the inverted mirrored right triangle determines the number of rows and columns, and the stars are printed in the shape of an inverted right triangle. The spaces are printed before the stars to create the mirrored effect, and the number of stars in each row decreases from top to bottom.

Hollow Inverted Mirrored Right Triangle Star Pattern:

Certainly! Here’s an example of a program in C that prints a hollow inverted mirrored right triangle star pattern:

#include <stdio.h>

// Function to print a hollow inverted mirrored right triangle star pattern
void printHollowInvertedMirroredRightTriangle(int n) {
    int i, j;

    // Iterate for each row
    for (i = n; i >= 1; i--) {
        // Print spaces in each row
        for (j = 1; j <= n - i; j++) {
            printf(" ");
        }

        // Print stars and spaces in each row
        for (j = 1; j <= i; j++) {
            if (j == 1 || j == i || i == n)
                printf("*");
            else
                printf(" ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the hollow inverted mirrored right triangle: ");
    scanf("%d", &size);

    printf("Hollow Inverted Mirrored Right Triangle Star Pattern:\n");
    printHollowInvertedMirroredRightTriangle(size);

    return 0;
}

In this program, we have a function printHollowInvertedMirroredRightTriangle that takes an integer n as input and prints a hollow inverted mirrored right triangle star pattern. The printHollowInvertedMirroredRightTriangle function uses two nested loops to print spaces, stars, and spaces in each row. The first loop is responsible for printing the spaces in each row, which are increasing as the rows decrease. The second loop is used to print stars and spaces based on the row and column position. If the column position is the first or last column or if the row is the last row, a star is printed. Otherwise, a space is printed. The main function prompts the user to enter the size of the hollow inverted mirrored right triangle and then calls the printHollowInvertedMirroredRightTriangle function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the hollow inverted mirrored right triangle: 5
Hollow Inverted Mirrored Right Triangle Star Pattern:
*****
 *  *
  * *
   **
    *

The size of the hollow inverted mirrored right triangle determines the number of rows and columns. The spaces are printed before the stars to create the mirrored effect. The first and last columns, as well as the last row, are filled with stars. The remaining positions are filled with spaces to form the hollow inverted mirrored right triangle pattern.

Pyramid Star Pattern:

Certainly! Here’s an example of a program in C that prints a pyramid star pattern:

#include <stdio.h>

// Function to print a pyramid star pattern
void printPyramid(int n) {
    int i, j, space;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in each row
        for (space = 1; space <= n - i; space++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= 2 * i - 1; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the pyramid: ");
    scanf("%d", &size);

    printf("Pyramid Star Pattern:\n");
    printPyramid(size);

    return 0;
}

In this program, we have a function printPyramid that takes an integer n as input and prints a pyramid star pattern. The printPyramid function uses two nested loops to print spaces and stars in each row. The first loop is responsible for printing the spaces in each row, which are decreasing as the rows increase. The second loop is used to print the stars in each row, and the number of stars is increasing as the rows increase. The main function prompts the user to enter the size of the pyramid and then calls the printPyramid function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the pyramid: 5
Pyramid Star Pattern:
    *
   ***
  *****
 *******
*********

The size of the pyramid determines the number of rows and columns, and the stars are printed in the shape of a pyramid. The spaces are printed before the stars to align them properly and create the pyramid shape. The number of stars in each row follows the pattern of odd numbers, starting from 1 and increasing by 2 for each row.

Hollow Pyramid Star Pattern:

Certainly! Here’s an example of a program in C that prints a hollow pyramid star pattern:

#include <stdio.h>

// Function to print a hollow pyramid star pattern
void printHollowPyramid(int n) {
    int i, j, space;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in each row
        for (space = 1; space <= n - i; space++) {
            printf(" ");
        }

        // Print stars and spaces in each row
        for (j = 1; j <= 2 * i - 1; j++) {
            if (i == n || j == 1 || j == 2 * i - 1)
                printf("*");
            else
                printf(" ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the hollow pyramid: ");
    scanf("%d", &size);

    printf("Hollow Pyramid Star Pattern:\n");
    printHollowPyramid(size);

    return 0;
}

In this program, we have a function printHollowPyramid that takes an integer n as input and prints a hollow pyramid star pattern. The printHollowPyramid function uses two nested loops to print spaces, stars, and spaces in each row. The first loop is responsible for printing the spaces in each row, which are decreasing as the rows increase. The second loop is used to print stars and spaces based on the row and column position. If the row is the last row or if the column position is the first or last column, a star is printed. Otherwise, a space is printed to create the hollow effect. The main function prompts the user to enter the size of the hollow pyramid and then calls the printHollowPyramid function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the hollow pyramid: 5
Hollow Pyramid Star Pattern:
    *
   * *
  *   *
 *     *
*********

The size of the hollow pyramid determines the number of rows and columns. The spaces are printed before the stars to align them properly and create the pyramid shape. The first and last columns, as well as the last row, are filled with stars. The remaining positions are filled with spaces to form the hollow pyramid pattern.

Inverted Pyramid Star Pattern:

Certainly! Here’s an example of a program in C that prints an inverted pyramid star pattern:

#include <stdio.h>

// Function to print an inverted pyramid star pattern
void printInvertedPyramid(int n) {
    int i, j, space;

    // Iterate for each row
    for (i = n; i >= 1; i--) {
        // Print spaces in each row
        for (space = 1; space <= n - i; space++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= 2 * i - 1; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the inverted pyramid: ");
    scanf("%d", &size);

    printf("Inverted Pyramid Star Pattern:\n");
    printInvertedPyramid(size);

    return 0;
}

In this program, we have a function printInvertedPyramid that takes an integer n as input and prints an inverted pyramid star pattern. The printInvertedPyramid function uses two nested loops to print spaces and stars in each row. The first loop is responsible for printing the spaces in each row, which are increasing as the rows decrease. The second loop is used to print the stars in each row, and the number of stars is decreasing as the rows decrease. The main function prompts the user to enter the size of the inverted pyramid and then calls the printInvertedPyramid function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the inverted pyramid: 5
Inverted Pyramid Star Pattern:
*********
 *******
  *****
   ***
    *

The size of the inverted pyramid determines the number of rows and columns, and the stars are printed in the shape of an inverted pyramid. The spaces are printed before the stars to align them properly and create the inverted pyramid shape. The number of stars in each row follows the pattern of odd numbers, starting from 2*n-1 and decreasing by 2 for each row.

Hollow Pyramid Star Pattern:

Certainly! Here’s an example of a program in C that prints a hollow pyramid star pattern:

#include <stdio.h>

// Function to print a hollow pyramid star pattern
void printHollowPyramid(int n) {
    int i, j, space;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print spaces in each row
        for (space = 1; space <= n - i; space++) {
            printf(" ");
        }

        // Print stars and spaces in each row
        for (j = 1; j <= 2 * i - 1; j++) {
            if (i == 1 || j == 1 || j == 2 * i - 1)
                printf("*");
            else
                printf(" ");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the hollow pyramid: ");
    scanf("%d", &size);

    printf("Hollow Pyramid Star Pattern:\n");
    printHollowPyramid(size);

    return 0;
}

In this program, we have a function printHollowPyramid that takes an integer n as input and prints a hollow pyramid star pattern. The printHollowPyramid function uses two nested loops to print spaces, stars, and spaces in each row. The first loop is responsible for printing the spaces in each row, which are decreasing as the rows increase. The second loop is used to print stars and spaces based on the row and column position. If the row is the first row or if the column position is the first or last column, a star is printed. Otherwise, a space is printed to create the hollow effect. The main function prompts the user to enter the size of the hollow pyramid and then calls the printHollowPyramid function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the hollow pyramid: 5
Hollow Pyramid Star Pattern:
    *
   * *
  *   *
 *     *
*********

The size of the hollow pyramid determines the number of rows and columns. The spaces are printed before the stars to align them properly and create the pyramid shape. The first row and the first and last columns are filled with stars. The remaining positions are filled with spaces to form the hollow pyramid pattern.

Half Diamond Star Pattern:

Certainly! Here’s an example of a program in C that prints a half diamond star pattern:

#include <stdio.h>

// Function to print a half diamond star pattern
void printHalfDiamond(int n) {
    int i, j;

    // Iterate for each row
    for (i = 1; i <= n; i++) {
        // Print stars in increasing order
        for (j = 1; j <= i; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }

    // Iterate for each row
    for (i = n - 1; i >= 1; i--) {
        // Print stars in decreasing order
        for (j = 1; j <= i; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the half diamond: ");
    scanf("%d", &size);

    printf("Half Diamond Star Pattern:\n");
    printHalfDiamond(size);

    return 0;
}

In this program, we have a function printHalfDiamond that takes an integer n as input and prints a half diamond star pattern. The printHalfDiamond function uses two nested loops to print stars in increasing order for the first half of the diamond and in decreasing order for the second half of the diamond. The first loop is responsible for printing stars in increasing order from 1 to n in each row. The second loop is responsible for printing stars in decreasing order from n-1 to 1 in each row. The main function prompts the user to enter the size of the half diamond and then calls the printHalfDiamond function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the half diamond: 5
Half Diamond Star Pattern:
*
**
***
****
*****
****
***
**
*

The size of the half diamond determines the number of rows and columns. In the first half, the number of stars increases by one in each row, and in the second half, the number of stars decreases by one in each row, creating the shape of a half diamond.

Diamond Star Pattern:

Certainly! Here’s an example of a program in C that prints a diamond star pattern:

#include <stdio.h>

// Function to print a diamond star pattern
void printDiamond(int n) {
    int i, j, space;

    // Print upper half of the diamond
    for (i = 1; i <= n; i++) {
        // Print spaces in each row
        for (space = 1; space <= n - i; space++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= 2 * i - 1; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }

    // Print lower half of the diamond
    for (i = n - 1; i >= 1; i--) {
        // Print spaces in each row
        for (space = 1; space <= n - i; space++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= 2 * i - 1; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the diamond: ");
    scanf("%d", &size);

    printf("Diamond Star Pattern:\n");
    printDiamond(size);

    return 0;
}

In this program, we have a function printDiamond that takes an integer n as input and prints a diamond star pattern. The printDiamond function uses two nested loops to print spaces and stars in each row for both the upper and lower halves of the diamond. The first loop is responsible for printing the spaces in each row, which are decreasing as the rows increase for the upper half and increasing as the rows decrease for the lower half. The second loop is used to print the stars in each row, and the number of stars is increasing and decreasing as the rows increase and decrease. The main function prompts the user to enter the size of the diamond and then calls the printDiamond function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the diamond: 5
Diamond Star Pattern:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *

The size of the diamond determines the number of rows and columns. The spaces are printed before the stars to align them properly and create the diamond shape. The number of stars in each row follows the pattern of odd numbers, starting from 1 and increasing by 2 for the upper half and decreasing by 2 for the lower half.

Right Arrow Star Pattern:

Certainly! Here’s an example of a program in C that prints a right arrow star pattern:

#include <stdio.h>

// Function to print a right arrow star pattern
void printRightArrow(int n) {
    int i, j;

    // Print upper part of the arrow
    for (i = 1; i <= n; i++) {
        // Print stars in each row
        for (j = 1; j <= i; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }

    // Print lower part of the arrow
    for (i = n - 1; i >= 1; i--) {
        // Print stars in each row
        for (j = 1; j <= i; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the right arrow: ");
    scanf("%d", &size);

    printf("Right Arrow Star Pattern:\n");
    printRightArrow(size);

    return 0;
}

In this program, we have a function printRightArrow that takes an integer n as input and prints a right arrow star pattern. The printRightArrow function uses two nested loops to print stars in increasing order for the upper part of the arrow and in decreasing order for the lower part of the arrow. The first loop is responsible for printing stars in increasing order from 1 to n in each row for the upper part. The second loop is responsible for printing stars in decreasing order from n-1 to 1 in each row for the lower part. The main function prompts the user to enter the size of the right arrow and then calls the printRightArrow function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the right arrow: 5
Right Arrow Star Pattern:
*
**
***
****
*****
****
***
**
*

The size of the right arrow determines the number of rows in the arrow. In the upper part of the arrow, the number of stars increases by one in each row. In the lower part, the number of stars decreases by one in each row. The stars are printed in the shape of a right arrow.

Left Arrow Star Pattern:

Certainly! Here’s an example of a program in C that prints a left arrow star pattern:

#include <stdio.h>

// Function to print a left arrow star pattern
void printLeftArrow(int n) {
    int i, j;

    // Print upper part of the arrow
    for (i = 1; i <= n; i++) {
        // Print spaces in each row
        for (j = 1; j <= n - i; j++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= i; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }

    // Print lower part of the arrow
    for (i = n - 1; i >= 1; i--) {
        // Print spaces in each row
        for (j = 1; j <= n - i; j++) {
            printf(" ");
        }

        // Print stars in each row
        for (j = 1; j <= i; j++) {
            printf("*");
        }

        // Move to the next line
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the left arrow: ");
    scanf("%d", &size);

    printf("Left Arrow Star Pattern:\n");
    printLeftArrow(size);

    return 0;
}

In this program, we have a function printLeftArrow that takes an integer n as input and prints a left arrow star pattern. The printLeftArrow function uses two nested loops to print spaces and stars in each row for both the upper and lower parts of the arrow. The first loop is responsible for printing the spaces in each row, which are decreasing as the rows increase for the upper part and increasing as the rows decrease for the lower part. The second loop is used to print the stars in each row, and the number of stars is increasing and decreasing as the rows increase and decrease. The main function prompts the user to enter the size of the left arrow and then calls the printLeftArrow function to print the pattern.

Here’s an example output for size = 5:

Enter the size of the left arrow: 5
Left Arrow Star Pattern:
    *
   **
  ***
 ****
*****
 ****
  ***
   **
    *

The size of the left arrow determines the number of rows and columns. The spaces are printed before the stars to align them properly and create the left arrow shape. The number of stars in each row follows the pattern of increasing and decreasing, creating the left arrow shape.

Plus Star Pattern:

Certainly! Here’s an example of a program in C that prints a plus star pattern:

#include <stdio.h>

// Function to print a plus star pattern
void printPlus(int n) {
    int i, j;

    // Print horizontal line
    for (i = 1; i <= n; i++) {
        for (j = 1; j <= n; j++) {
            if (i == (n / 2) + 1)
                printf("*");
            else
                printf(" ");
        }
        printf("\n");
    }

    // Print vertical line
    for (i = 1; i <= n; i++) {
        if (i == (n / 2) + 1)
            printf("*");
        else {
            for (j = 1; j <= n; j++) {
                if (j == (n / 2) + 1)
                    printf("*");
                else
                    printf(" ");
            }
        }
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the plus: ");
    scanf("%d", &size);

    printf("Plus Star Pattern:\n");
    printPlus(size);

    return 0;
}

In this program, we have a function printPlus that takes an integer n as input and prints a plus star pattern. The printPlus function uses two nested loops to print stars in the shape of a plus. The first loop is responsible for printing a horizontal line consisting of n stars. The stars are printed only in the middle row ((n / 2) + 1). The second loop is responsible for printing a vertical line consisting of n stars. The stars are printed in the middle column ((n / 2) + 1) for all rows except the middle row, where the entire row is filled with stars. The main function prompts the user to enter the size of the plus and then calls the printPlus function to print the pattern.

Here’s an example output for size = 7:

Enter the size of the plus: 7
Plus Star Pattern:
   *
   *
   *
*******
   *
   *
   *

The size of the plus determines the width and height of the plus. The stars are printed to form a horizontal and vertical line crossing at the center.

X Star Pattern:

Certainly! Here’s an example of a program in C that prints an X star pattern:

#include <stdio.h>

// Function to print an X star pattern
void printX(int n) {
    int i, j;

    // Print upper part of the X
    for (i = 1; i <= n; i++) {
        for (j = 1; j <= n; j++) {
            if (j == i || j == (n - i + 1))
                printf("*");
            else
                printf(" ");
        }
        printf("\n");
    }

    // Print lower part of the X
    for (i = n - 1; i >= 1; i--) {
        for (j = 1; j <= n; j++) {
            if (j == i || j == (n - i + 1))
                printf("*");
            else
                printf(" ");
        }
        printf("\n");
    }
}

int main() {
    int size;

    printf("Enter the size of the X: ");
    scanf("%d", &size);

    printf("X Star Pattern:\n");
    printX(size);

    return 0;
}

In this program, we have a function printX that takes an integer n as input and prints an X star pattern. The printX function uses two nested loops to print stars in the shape of an X. The stars are printed at positions where the row number (i) is equal to the column number (j) or where the column number is equal to (n - i + 1). This creates the diagonal lines that form the X shape. The main function prompts the user to enter the size of the X and then calls the printX function to print the pattern.

Here’s an example output for size = 7:

Enter the size of the X: 7
X Star Pattern:
*     *
 *   *
  * *
   *
  * *
 *   *
*     *

The size of the X determines the width and height of the X pattern. The stars are printed to form two diagonal lines crossing each other at the center.