100+ C Patterns
🪐

🎉 101 patterns live – more coming soon! Stay tuned for updates. Last updated on May 20, 2025

Pattern 1 : 5x5 Star Grid

easy
#include <stdio.h>

int main() {
    int i, j;
    int rows = 5;
    int columns = 5;
    for(i = 1; i <= rows; i++) {
        for(j = 1; j <= columns; j++) {
            printf("* ");
        }
        printf("\n");
    }
    return 0;
}
Output:
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

Pattern 2: Right-Angled Triangle

easy
#include <stdio.h>

int main() {
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j <= i; j++) {
            printf("* ");
        }
        printf("\n");
    }
    return 0;
}
Output:
* 
* * 
* * * 
* * * * 
* * * * * 

Pattern 3: Inverted Right-Angled Triangle

easy
#include <stdio.h>

int main() {
    int i, j;
    int rows = 5; // Number of rows

    // Outer loop for the number of rows
    for(i = rows; i >= 1; i--) {
        // Inner loop to print stars in each row
        for(j = 1; j <= i; j++) {
            printf("*");
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
*****
****
***
**
*

Pattern 4: Pyramid Pattern

medium
#include <stdio.h>

int main() {
    int i, j, k;
    int rows = 5; // Number of rows

    // Outer loop for the number of rows
    for(i = 1; i <= rows; i++) {
        // Inner loop to print spaces
        for(j = i; j < rows; j++) {
            printf(" ");
        }
        // Inner loop to print stars
        for(k = 1; k <= (2*i - 1); k++) {
            printf("*");
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
    *
   ***
  *****
 *******
*********

Pattern 5: Diamond Pattern

hard
#include <stdio.h>

int main() {
    int i, j;
    int rows = 5; // Number of rows for the upper half

    // Loop through all rows for the entire diamond
    for(i = 1; i <= 2*rows - 1; i++) {
        // Determine the number of stars and spaces for each row
        int stars = i <= rows ? 2*i - 1 : 2*(2*rows - i) - 1;
        int spaces = i <= rows ? rows - i : i - rows;

        // Print spaces
        for(j = 1; j <= spaces; j++) {
            printf(" ");
        }
        // Print stars
        for(j = 1; j <= stars; j++) {
            printf("*");
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *

Pattern 6: Hollow Square Pattern

easy
#include <stdio.h>

int main() {
    int i, j;
    int size = 5; // Size of the square

    // Loop through each row
    for(i = 1; i <= size; i++) {
        // Loop through each column in the row
        for(j = 1; j <= size; j++) {
            // Print '*' for the border or for the first and last rows and columns
            if (i == 1 || i == size || j == 1 || j == size) {
                printf("*");
            } else {
                // Print space for the hollow part
                printf(" ");
            }
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
*****
*   *
*   *
*   *
*****

Pattern 7: Number Triangle Pattern

easy
#include <stdio.h>

int main() {
    int i, j;
    int rows = 5; // Number of rows for the triangle

    // Loop through each row
    for(i = 1; i <= rows; i++) {
        // Loop through each column in the row
        for(j = 1; j <= i; j++) {
            // Print numbers from 1 to the current row number
            printf("%d", j);
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
1
12
123
1234
12345

Pattern 8: Inverted Pyramid of Numbers

medium
#include <stdio.h>

int main() {
    int i, j;
    int rows = 5; // Number of rows for the pyramid

    // Loop through each row
    for(i = rows; i >= 1; i--) {
        // Loop through each column in the row
        for(j = i; j >= 1; j--) {
            // Print numbers from the current row number down to 1
            printf("%d", j);
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
54321
4321
321
21
1

Pattern 9: Right-Aligned Triangle Pattern of Numbers

medium
#include <stdio.h>

int main() {
    int i, j, k;
    int rows = 5; // Number of rows for the triangle

    // Loop through each row
    for (i = 1; i <= rows; i++) {
        // Print spaces for alignment
        for (j = 1; j <= rows - i; j++) {
            printf(" ");
        }
        // Print numbers in increasing order
        for (k = 1; k <= i; k++) {
            printf("%d", k);
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
    1
   12
  123
 1234
12345

Pattern 10: Pyramid Pattern of Numbers

medium
#include <stdio.h>

int main() {
    int i, j, k;
    int rows = 5; // Number of rows for the pyramid

    // Loop through each row
    for (i = 1; i <= rows; i++) {
        // Print spaces to center-align the pyramid
        for (j = 1; j <= rows - i; j++) {
            printf(" ");
        }
        // Print numbers in increasing order
        for (k = 1; k <= i; k++) {
            printf("%d ", k);
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
    1
   1 2
  1 2 3
 1 2 3 4
1 2 3 4 5

Pattern 11: Inverted Half Pyramid of Numbers

easy
#include <stdio.h>

int main() {
    int i, j;
    int rows = 5; // Number of rows for the pyramid

    // Loop through each row
    for (i = rows; i >= 1; i--) {
        // Print numbers in increasing order
        for (j = 1; j <= i; j++) {
            printf("%d ", j);
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Pattern 12: Reverse Pyramid of Numbers

medium
#include <stdio.h>

int main() {
    int i, j, k;
    int rows = 5; // Number of rows for the pyramid

    // Loop through each row
    for (i = 0; i < rows; i++) {
        // Print leading spaces for alignment
        for (j = 0; j < i; j++) {
            printf(" ");
        }
        // Print numbers in increasing order
        for (k = 1; k <= rows - i; k++) {
            printf("%d ", k);
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
1 2 3 4 5
 1 2 3 4
  1 2 3
   1 2
    1

Pattern 13: Hollow Square Pattern with Diagonals

medium
#include <stdio.h>

int main() {
    int i, j;
    int rows = 5; // Number of rows and columns for the square

    // Loop through each row
    for (i = 1; i <= rows; i++) {
        // Loop through each column
        for (j = 1; j <= rows; j++) {
            // Print stars on the border or diagonals
            if (i == 1 || i == rows || j == 1 || j == rows || i == j || j == (rows - i + 1)) {
                printf("* ");
            } else {
                printf("  ");
            }
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
* * * * *
* *   * *
*   *   *
* *   * *
* * * * *

Pattern 14: Pascal's Triangle

hard
#include <stdio.h>

int main() {
    int rows = 5; // Number of rows for Pascal's Triangle
    int coef = 1; // Coefficient
    int i, j, space;

    // Loop through each row
    for (i = 0; i < rows; i++) {
        // Print spaces for alignment
        for (space = 1; space <= rows - i; space++) {
            printf(" ");
        }

        // Calculate and print each coefficient
        for (j = 0; j <= i; j++) {
            if (j == 0 || i == 0) {
                coef = 1; // First element is always 1
            } else {
                coef = coef * (i - j + 1) / j; // Calculate using the previous element
            }
            printf("%d ", coef);
        }
        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
    1
   1 1
  1 2 1
 1 3 3 1
1 4 6 4 1

Pattern 15: Sandglass Star Pattern

hard
#include <stdio.h>

int main() {
    int rows = 5; // Number of rows for the pattern
    int i, j;

    // Loop through each row
    for (i = 0; i < 2 * rows - 1; i++) {
        // Print leading spaces
        for (j = 0; j < (i < rows ? i : (2 * rows - 2 - i)); j++) {
            printf(" ");
        }

        // Print stars
        for (j = 0; j < (i < rows ? (rows - i) : (i - rows + 2)); j++) {
            printf("* ");
        }

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

    return 0;
}
Output:
* * * * *
 * * * *
  * * *
   * *
    *
   * *
  * * *
 * * * *
* * * * *

Pattern 16: Diamond of Numbers

hard
#include <stdio.h>

int main() {
    int rows = 5; // Number of rows for the widest part of the diamond
    int i, j, k;

    // Loop through each row
    for (i = 1; i <= 2 * rows - 1; i++) {
        // Determine the current row in the diamond pattern
        int num = (i <= rows) ? i : (2 * rows - i);

        // Print leading spaces
        for (j = rows; j > num; j--) {
            printf(" ");
        }

        // Print increasing numbers
        for (k = 1; k <= num; k++) {
            printf("%d", k);
        }

        // Print decreasing numbers
        for (k = num - 1; k >= 1; k--) {
            printf("%d", k);
        }

        // New line after each row
        printf("\n");
    }

    return 0;
}
Output:
        1
       121
      12321
     1234321
    123454321
     1234321
      12321
       121
        1

Pattern 17: Hourglass Star Pattern

hard
#include <stdio.h>

int main() {
    int rows = 5; // Number of rows for the widest part of the hourglass
    int i, j;

    // Loop through each row
    for (i = 1; i <= 2 * rows - 1; i++) {
        // Determine the number of stars in the current row
        int numStars = (i <= rows) ? (rows - i + 1) : (i - rows + 1);
        
        // Print leading spaces for the hourglass effect
        for (j = 1; j < (i <= rows ? i : (2 * rows - i)); j++) {
            printf(" ");
        }

        // Print stars for the current row
        for (j = 1; j <= numStars; j++) {
            printf("*");
        }
        
        // Move to the next line
        printf("\n");
    }

    return 0;
}
Output:
*****
 ****
  ***
   **
    *
   **
  ***
 ****
*****

Pattern 18: Zigzag Pattern of Numbers

hard
#include <stdio.h>

int main() {
    int rows = 5; // Number of rows for the zigzag pattern
    int i, j;

    // Loop through each row
    for (i = 1; i <= rows; i++) {
        // If the row number is odd, print increasing numbers
        if (i % 2 == 1) {
            for (j = 1; j <= rows - i + 1; j++) {
                printf("%d", j);
            }
        }
        // If the row number is even, print decreasing numbers
        else {
            for (j = rows - i + 1; j >= 1; j--) {
                printf("%d", j);
            }
        }
        
        // Move to the next line after printing each row
        printf("\n");
    }

    return 0;
}
Output:
12345
4321
123
21
1

Pattern 19: Cross Pattern of Stars

easy
#include <stdio.h>

int main() {
    int size = 5; // Size of the pattern (must be an odd number)
    int i, j;
    int middle = size / 2; // Calculate the middle index

    // Loop through each row
    for (i = 0; i < size; i++) {
        // Loop through each column in the row
        for (j = 0; j < size; j++) {
            // Print '*' for the cross
            if (i == middle || j == middle) {
                printf("*");
            } else {
                printf(" ");
            }
        }
        // Move to the next line after printing each row
        printf("\n");
    }

    return 0;
}
Output:
  *  
  *  
*****
  *  
  *  

Pattern 20: Right Arrow Pattern of Stars

medium
#include <stdio.h>

int main() {
    int rows = 5; // Number of rows for the arrow pattern
    int i, j;

    // Upper half of the arrow
    for (i = 1; i <= rows; i++) {
        for (j = 1; j <= i; j++) {
            printf("*");
        }
        printf("\n");
    }

    // Lower half of the arrow
    for (i = rows - 1; i >= 1; i--) {
        for (j = 1; j <= i; j++) {
            printf("*");
        }
        printf("\n");
    }

    return 0;
}
Output:
*
**
***
****
*****
****
***
**
*

Pattern 21: Hollow Right-Angled Triangle

easy
#include <stdio.h>

int main() {
    int rows = 5; // Number of rows
    int i, j;

    // Loop through each row
    for (i = 1; i <= rows; i++) {
        // Loop through each column
        for (j = 1; j <= i; j++) {
            // Print stars at the borders or the end of each row
            if (i == rows || j == 1 || j == i) {
                printf("*");
            } else {
                printf(" ");
            }
        }
        printf("\n");
    }

    return 0;
}
Output:
*
**
* *
*  *
*****

Pattern 22: Hollow X Shape

medium
#include <stdio.h>

int main() {
    int n = 7;  // Set the size of the pattern (must be an odd number)

    // Generate the hollow X shape
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            // Print stars on the diagonals
            if (i == j || i + j == n - 1) {
                printf("*");
            } else {
                printf(" ");
            }
        }
        printf("\n");
    }
    
    return 0;
}
Output:
*     *
 *   * 
  * *  
   *   
  * *  
 *   * 
*     *

Pattern 23: Hollow Hourglass Shape

medium
#include <stdio.h>

int main() {
    int n = 7;  // Set the size of the pattern (must be an odd number)

    // Generate the hourglass shape
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            // Print stars on the boundaries of the hourglass
            if (i <= n / 2) {
                // Upper part of the hourglass
                if (j == i || j == n - i - 1 || i == 0) {
                    printf("*");
                } else {
                    printf(" ");
                }
            } else {
                // Lower part of the hourglass
                if (j == n - i - 1 || j == i || i == n - 1) {
                    printf("*");
                } else {
                    printf(" ");
                }
            }
        }
        printf("\n");
    }

    return 0;
}
Output:
*******
 *   * 
  * *  
   *   
  * *  
 *   * 
*******

Pattern 24: H Shape

easy
#include <stdio.h>

int main() {
    int n = 5;  // Set the size of the pattern

    // Generate the H shape
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j == 0 || j == n - 1 || i == n / 2) {
                printf("*");
            } else {
                printf(" ");
            }
        }
        printf("\n");
    }

    return 0;
}
Output:
*   *
*   *
*****
*   *
*   *

Pattern 25: T Shape

easy
#include <stdio.h>

int main() {
    int n = 5;  // Set the size of the pattern

    // Generate the T shape
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == 0 || j == n / 2) {
                printf("*");
            } else {
                printf(" ");
            }
        }
        printf("\n");
    }

    return 0;
}
Output:
*****
  *  
  *  
  *  
  *  

Pattern 26: Arrow Pattern

medium
#include <stdio.h>

int main() {
    int n = 5;  // Set the size of the pattern
    int mid = n / 2;  // Middle index for the arrow

    // Generate the arrow pattern
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i <= mid) {
                if (j == mid - i || j == mid + i || i == mid) {
                    printf("*");
                } else {
                    printf(" ");
                }
            } else {
                if (j == i - mid || j == 3 * mid - i || i == 2 * mid) {
                    printf("*");
                } else {
                    printf(" ");
                }
            }
        }
        printf("\n");
    }

    return 0;
}
Output:
  *  
 * * 
*****
 * * 
*****

Pattern 27: Floyd's Triangle

easy
#include <stdio.h>

int main() {
    int rows = 4; // Number of rows
    int num = 1; // Starting number

    for (int i = 1; i <= rows; i++) { // Loop through each row
        for (int j = 1; j <= i; j++) { // Print numbers in each row
            printf("%d ", num++);
        }
        printf("\n"); // Move to the next line after each row
    }

    return 0;
}
Output:
1
2 3
4 5 6
7 8 9 10

Pattern 28: Pyramid of Numbers

medium
#include <stdio.h>

int main() {
    int rows = 5; // Number of rows

    for (int i = 1; i <= rows; i++) { // Loop through each row
        // Print leading spaces
        for (int j = i; j < rows; j++) {
            printf(" ");
        }
        // Print increasing numbers
        for (int j = 1; j <= i; j++) {
            printf("%d", j);
        }
        // Print decreasing numbers
        for (int j = i - 1; j >= 1; j--) {
            printf("%d", j);
        }
        printf("\n"); // Move to the next line after each row
    }

    return 0;
}
Output:
    1
   121
  12321
 1234321
123454321

Pattern 29: Butterfly Pattern

hard
#include <stdio.h>

int main() {
    int n = 5; // Number of rows

    // Loop through each row
    for (int i = 1; i <= 2 * n; i++) {
        int stars = (i <= n) ? i : (2 * n - i); // Number of stars on the left side
        int spaces = (i <= n) ? (2 * (n - i)) : (2 * (i - n)); // Number of spaces in the middle

        // Print stars on the left side
        for (int j = 1; j <= stars; j++) {
            printf("*");
        }

        // Print spaces in the middle
        for (int j = 1; j <= spaces; j++) {
            printf(" ");
        }

        // Print stars on the right side
        for (int j = 1; j <= stars; j++) {
            printf("*");
        }

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

    return 0;
}
Output:
*        *
**      **
***    ***
****  ****
**********
****  ****
***    ***
**      **
*        *

Pattern 30: Number Hourglass Pattern

easy
#include <stdio.h>

int main() {
    int n = 5; // Number of rows in the upper part

    // Loop through each row
    for (int i = 1; i <= 2 * n - 1; i++) {
        int numDigits = (i <= n) ? (n - i + 1) : (i - n + 1); // Number of digits to print
        int start = (i <= n) ? (n - i + 1) : (i - n + 1); // Starting number

        // Print digits
        for (int j = start; j > 0; j--) {
            printf("%d", j);
        }

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

    return 0;
}
Output:
54321
4321
321
21
1
21
321
4321
54321

Pattern 31: Right Hollow Diamond Pattern

medium
#include <stdio.h>

int main() {
    int n = 5; // Number of rows for the upper half (excluding the middle row)

    // Loop through each row
    for (int i = 1; i <= 2 * n - 1; i++) {
        int spaces = (i <= n) ? (n - i) : (i - n); // Number of leading spaces
        int stars = (i <= n) ? i : (2 * n - i); // Number of stars to print in the row

        // Print leading spaces
        for (int j = 0; j < spaces; j++) {
            printf(" ");
        }

        // Print stars with spaces in between
        for (int j = 1; j <= stars; j++) {
            if (j == 1 || j == stars) {
                printf("*");
            } else {
                printf(" ");
            }
        }

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

    return 0;
}
Output:
    *
   **
  * *
 *  *
*   *
 *  *
  * *
   **
    *

Pattern 32: Checkerboard Pattern

easy
#include <stdio.h>

int main() {
    int n = 4; // Size of the checkerboard (n x n)

    // Loop through each row
    for (int i = 0; i < n; i++) {
        // Loop through each column
        for (int j = 0; j < n; j++) {
            // Print '*' or ' ' based on the position
            if ((i + j) % 2 == 0) {
                printf("*");
            } else {
                printf(" ");
            }
        }
        printf("\n"); // Move to the next line after printing one row
    }

    return 0;
}
Output:
* * 
 * *
* * 
 * *

Pattern 33: Right Inverted Pyramid of Numbers

easy
#include <stdio.h>

int main() {
    int n = 5; // Number of rows in the pyramid

    // Loop through each row
    for (int i = 0; i < n; i++) {
        // Print leading spaces
        for (int j = 0; j < i; j++) {
            printf(" ");
        }

        // Print decreasing numbers
        for (int j = n - i; j > 0; j--) {
            printf("%d", j);
        }

        printf("\n"); // Move to the next line after printing one row
    }

    return 0;
}
Output:
54321
 4321
  321
   21
    1

Pattern 34: Diamond Pattern with Alphabets

hard
#include <stdio.h>

int main() {
    int n = 3; // Number of rows for the upper part (excluding the middle row)
    char currentChar = 'A'; // Starting character

    // Loop through each row (upper part including the middle)
    for (int i = 0; i < 2 * n - 1; i++) {
        int numChars = (i < n) ? (2 * i + 1) : (2 * (2 * n - i - 2) + 1); // Number of characters in the row
        int spaces = (i < n) ? (n - i - 1) : (i - n + 1); // Number of leading spaces

        // Print leading spaces
        for (int j = 0; j < spaces; j++) {
            printf(" ");
        }

        // Print characters
        char ch = currentChar;
        for (int j = 0; j < numChars; j++) {
            printf("%c", ch);
            ch++;
        }

        // Update currentChar to the next character
        currentChar += numChars;

        printf("\n"); // Move to the next line after printing characters for the current row
    }

    return 0;
}
Output:
  A
 BCD
EFGHI
 JKL
  M

Pattern 35: Diamond Pattern with Alphabets (2)

medium
#include <stdio.h>

int main() {
    int n = 3; // Number of rows for the upper part (excluding the middle row)
    char startChar = 'A'; // Starting character

    // Loop through each row (upper part including the middle)
    for (int i = 0; i < 2 * n - 1; i++) {
        int numChars = (i < n) ? (2 * i + 1) : (2 * (2 * n - i - 2) + 1); // Number of characters in the row
        int spaces = (i < n) ? (n - i - 1) : (i - n + 1); // Number of leading spaces

        // Print leading spaces
        for (int j = 0; j < spaces; j++) {
            printf(" ");
        }

        // Print characters
        char currentChar = startChar;
        for (int j = 0; j < numChars; j++) {
            printf("%c", currentChar);
            currentChar++;
        }

        printf("\n"); // Move to the next line after printing characters for the current row
    }

    return 0;
}
Output:
  A
 ABC
ABCDE
 ABC
  A

Pattern 36: Right Hourglass Number Pattern

medium
#include <stdio.h>

int main() {
    int n = 5; // Number of columns in the widest part of the hourglass

    // Loop for each row
    for (int i = 0; i < 2 * n - 1; i++) {
        int num = (i < n) ? (n - i) : (i - n + 2); // Determine the number of digits to print
        int spaces = (i < n) ? i : (2 * n - i - 2); // Determine the number of leading spaces
        
        // Print leading spaces
        for (int j = 0; j < spaces; j++) {
            printf(" ");
        }
        
        // Print numbers in increasing order
        for (int j = 1; j <= num; j++) {
            printf("%d", j);
        }
        
        printf("\n"); // Move to the next line
    }

    return 0;
}
Output:
12345
 1234
  123
   12
    1
   12
  123
 1234
12345

Pattern 37: Diamond of Squares Pattern

medium
#include <stdio.h>

int main() {
    int n = 4; // Number of rows for the upper part of the diamond

    // Loop through each row
    for (int i = 1; i <= 2 * n - 1; i++) {
        int num = (i <= n) ? i : 2 * n - i; // Determine the highest square number in the current row
        int spaces = (i <= n) ? (n - i) : (i - n); // Calculate leading spaces

        // Print leading spaces
        for (int j = 0; j < spaces; j++) {
            printf(" ");
        }

        // Print squares
        for (int j = 1; j <= num; j++) {
            printf("%d ", j * j);
        }

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

    return 0;
}
Output:
   1
  1 4
 1 4 9
1 4 9 16
 1 4 9
  1 4
   1

Pattern 38: Alphabet Pyramid Pattern

easy
#include <stdio.h>

int main() {
    int n = 4; // Number of rows for the pattern

    // Loop for each row
    for (int i = 1; i <= n; i++) {
        // Print leading spaces
        for (int j = n - i; j > 0; j--) {
            printf(" ");
        }

        // Print increasing letters
        for (int j = 1; j <= i; j++) {
            printf("%c", 'A' + j - 1);
        }

        // Print decreasing letters
        for (int j = i - 1; j > 0; j--) {
            printf("%c", 'A' + j - 1);
        }

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

    return 0;
}
Output:
   A
  ABA
 ABCBA
ABCDCBA

Pattern 39: Right Half Pyramid

easy
#include <stdio.h>

int main()
{
    int rows = 5;

    // Loop for printing rows
    for (int i = 0; i < rows; i++) {
        
        // Loop for printing alphabets in each row
        for (int j = 0; j <= i; j++) {
            printf("%c ", 'A' + j);
        }
        printf("\n");
    }
    return 0;
}
Output:
A 
A B 
A B C 
A B C D 
A B C D E

Pattern 40: Rhombus Star Pattern

easy
#include <stdio.h>

int main()
{
    int rows = 5;

    // Outer loop for rows
    for (int i = 0; i < rows; i++) {
        
        // Inner loop to print spaces
        for (int j = 0; j < rows - i - 1; j++) {
            printf(" ");
        }
        
        // Inner loop to print stars
        for (int k = 0; k < rows; k++) {
            printf("* ");
        }
        
        printf("\n"); // Move to the next line
    }
    return 0;
}
Output:
    * * * * * 
   * * * * * 
  * * * * * 
 * * * * * 
* * * * *

Pattern 41: Rhombus Number Pattern

easy
#include <stdio.h>

int main()
{
    int rows = 5;

    // Loop through each row
    for (int i = 0; i < rows; i++) {
        
        // Print spaces to align numbers
        for (int j = 0; j < rows - i - 1; j++) {
            printf(" ");
        }
        
        // Print numbers in each row
        for (int k = 0; k < rows; k++) {
            printf("%d ", k + 1);
        }
        
        printf("\n"); // Move to the next line
    }
    return 0;
}
Output:
    1 2 3 4 5 
   1 2 3 4 5 
  1 2 3 4 5 
 1 2 3 4 5 
1 2 3 4 5

Pattern 42: Rhombus Alphabet Pattern

easy
#include <stdio.h>

int main()
{
    int rows = 5;

    // Loop through each row
    for (int i = 0; i < rows; i++) {
        
        // Print spaces to align letters
        for (int j = 0; j < rows - i - 1; j++) {
            printf(" ");
        }
        
        // Print letters in each row
        for (int k = 0; k < rows; k++) {
            printf("%c ", k + 'A');
        }
        
        printf("\n"); // Move to the next line
    }
    return 0;
}
Output:
    A B C D E 
   A B C D E 
  A B C D E 
 A B C D E 
A B C D E

Pattern 43: Number Hourglass Pattern

hard
#include <stdio.h>
int main()
{
    int rows = 5;

    // Loop through each row
    for (int i = 0; i < 2 * rows - 1; i++) {
        
        // Determine the number of leading spaces and numbers to print
        int comp;
        if (i < rows) {
            comp = 2 * i + 1;
        }
        else {
            comp = 2 * (2 * rows - i) - 3;
        }

        // Print leading spaces
        for (int j = 0; j < comp; j++) {
            printf(" ");
        }

        // Print numbers
        for (int k = 0; k < 2 * rows - comp; k++) {
            printf("%d ", k + 1);
        }
        printf("\n");
    }
    return 0;
}
Output:
 1 2 3 4 5 6 7 8 9 
   1 2 3 4 5 6 7 
     1 2 3 4 5 
       1 2 3 
         1 
       1 2 3 
     1 2 3 4 5 
   1 2 3 4 5 6 7 
 1 2 3 4 5 6 7 8 9

Pattern 44: Alphabet Hourglass Pattern

hard
#include <stdio.h>
int main()
{
    int rows = 5;

    // Loop through each row
    for (int i = 0; i < 2 * rows - 1; i++) {
        
        // Determine the number of leading spaces and alphabets to print
        int comp;
        if (i < rows) {
            comp = 2 * i + 1;
        }
        else {
            comp = 2 * (2 * rows - i) - 3;
        }

        // Print leading spaces
        for (int j = 0; j < comp; j++) {
            printf(" ");
        }

        // Print alphabets
        for (int k = 0; k < 2 * rows - comp; k++) {
            printf("%c ", k + 'A');
        }
        printf("\n");
    }
    return 0;
}
Output:
 A B C D E F G H I 
   A B C D E F G 
     A B C D E 
       A B C 
         A 
       A B C 
     A B C D E 
   A B C D E F G 
 A B C D E F G H I

Pattern 45: Number Hollow Square Pattern

easy
#include <stdio.h>

int main()
{
    int rows = 5;

    // Outer loop to iterate through each row
    for (int i = 0; i < rows; i++) {
        
        // Inner loop to print numbers in each row
        for (int j = 0; j < rows; j++) {
            // Statement to check boundary condition
            if (i > 0 && i < rows - 1 && j > 0 && j < rows - 1) {
                printf("  ");
            }
            else {
                printf("%d ", j + 1);
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
1 2 3 4 5 
1       5 
1       5 
1       5 
1 2 3 4 5

Pattern 46: Alphabet Hollow Square Pattern

easy
#include <stdio.h>

int main()
{
    int rows = 5;

    // Outer loop to iterate through each row
    for (int i = 0; i < rows; i++) {
        
        // Inner loop to print alphabet in each row
        for (int j = 0; j < rows; j++) {
            // Statement to check boundary condition
            if (i > 0 && i < rows - 1 && j > 0 && j < rows - 1) {
                printf("  ");
            }
            else {
                printf("%c ", j + 'A');
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
A B C D E 
A       E 
A       E 
A       E 
A B C D E

Pattern 47: Hollow Full Star Pyramid Pattern

medium
#include <stdio.h>

int main()
{
    int rows = 5;

    // First outer loop to iterate through each row
    for (int i = 0; i < rows; i++) {

        // First inner loop to print leading whitespaces
        for (int j = 0; j < 2 * (rows - i) - 1; j++) {
            printf(" ");
        }

        // Second inner loop to print stars and inner whitespaces
        for (int k = 0; k < 2 * i + 1; k++) {
            if (k == 0 || k == 2 * i || i == rows - 1) {
                printf("* ");
            }
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
         * 
       *   * 
     *       * 
   *           * 
 * * * * * * * * *

Pattern 48: Hollow Full Number Pyramid Pattern

medium
#include <stdio.h>

int main()
{
    int rows = 5;

    // First outer loop to iterate through each row
    for (int i = 0; i < rows; i++) {

        // First inner loop to print leading whitespaces
        for (int j = 0; j < 2 * (rows - i) - 1; j++) {
            printf(" ");
        }

        // Second inner loop to print numbers and inner whitespaces
        for (int k = 0; k < 2 * i + 1; k++) {
            if (k == 0 || k == 2 * i || i == rows - 1) {
                printf("%d ", k + 1);
            }
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
         1 
       1    3 
     1        5 
   1            7 
 1 2 3 4 5 6 7 8 9

Pattern 49: Hollow Full Alphabet Pyramid Pattern

medium
#include <stdio.h>

int main()
{
    int rows = 5;

    // First outer loop to iterate through each row
    for (int i = 0; i < rows; i++) {

        // First inner loop to print leading whitespaces
        for (int j = 0; j < 2 * (rows - i) - 1; j++) {
            printf(" ");
        }

        // Second inner loop to print alphabets and inner whitespaces
        for (int k = 0; k < 2 * i + 1; k++) {
            if (k == 0 || k == 2 * i || i == rows - 1) {
                printf("%c ", k + 'A');
            }
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
         A 
       A   C 
     A       E 
   A           G 
 A B C D E F G H I

Pattern 50: Hollow Inverted Full Pyramid Pattern

medium
#include <stdio.h>

int main()
{
    int rows = 5;

    // First loop iterating through each row
    for (int i = 0; i < rows; i++) {

        // First inner loop to print leading white space
        for (int j = 0; j < 2 * i + 1; j++) {
            printf(" ");
        }

        // Second inner loop to print stars and hollow white spaces
        for (int k = 0; k < 2 * (rows - i) - 1; k++) {
            if (k == 0 || k == 2 * (rows - i) - 2 || i == 0)
                printf("* ");
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
 * * * * * * * * * 
   *           * 
     *       * 
       *   * 
         *

Pattern 51: Hollow Inverted Full Pyramid Number Pattern

medium
#include <stdio.h>

int main()
{
    int rows = 5;

    // First loop iterating through each row
    for (int i = 0; i < rows; i++) {

        // First inner loop to print leading white spaces
        for (int j = 0; j < 2 * i + 1; j++) {
            printf(" ");
        }

        // Second inner loop to print numbers and hollow white spaces
        for (int k = 0; k < 2 * (rows - i) - 1; k++) {
            if (k == 0 || k == 2 * (rows - i) - 2 || i == 0)
                printf("%d ", k + 1);
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
 1 2 3 4 5 6 7 8 9 
   1           7 
     1       5 
       1   3 
         1

Pattern 52: Hollow Inverted Full Pyramid Alphabet Pattern

medium
#include <stdio.h>

int main()
{
    int rows = 5;

    // First loop iterating through each row
    for (int i = 0; i < rows; i++) {

        // First inner loop to print leading white spaces
        for (int j = 0; j < 2 * i + 1; j++) {
            printf(" ");
        }

        // Second inner loop to print alphabets and hollow white spaces
        for (int k = 0; k < 2 * (rows - i) - 1; k++) {
            if (k == 0 || k == 2 * (rows - i) - 2 || i == 0)
                printf("%c ", k + 'A');
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
 A B C D E F G H I 
   A           G 
     A       E 
       A   C 
         A

Pattern 53: Hollow Diamond Pattern Using Star

hard
#include <stdio.h>
int main()
{
    int n = 5;

    // First outer loop to iterate through each row
    for (int i = 0; i < 2 * n - 1; i++) {
        
        // Assigning values to the comparator according to row number
        int comp;
        if (i < n) {
            comp = n - i - 1;
        }
        else {
            comp = i - n + 1;
        }

        // First inner loop to print leading whitespaces
        for (int j = 0; j < comp; j++) {
            printf("  ");
        }

        // Second inner loop to print stars and inner whitespaces
        for (int k = 0; k < 2 * (n - comp) - 1; k++) {
            if (k == 0 || k == 2 * (n - comp) - 2) {
                printf("* ");
            }
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
         * 
       *   * 
     *       * 
   *           * 
 *               * 
   *           * 
     *       * 
       *   * 
         *

Pattern 54: Hollow Diamond Pattern Using Number

hard
#include <stdio.h>
int main()
{
    int n = 5;

    // First outer loop to iterate through each row
    for (int i = 0; i < 2 * n - 1; i++) {
        
        // Assigning values to the comparator according to row number
        int comp;
        if (i < n) {
            comp = n - i - 1;
        }
        else {
            comp = i - n + 1;
        }

        // First inner loop to print leading whitespaces
        for (int j = 0; j < comp; j++) {
            printf("  ");
        }

        // Second inner loop to print numbers and inner whitespaces
        for (int k = 0; k < 2 * (n - comp) - 1; k++) {
            if (k == 0 || k == 2 * (n - comp) - 2) {
                printf("%d ", k + 1);
            }
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
         1 
       1   3 
     1       5 
   1           7 
 1               9 
   1           7 
     1       5 
       1   3 
         1

Pattern 55: Hollow Diamond Pattern Using Alphabet

hard
#include <stdio.h>
int main()
{
    int n = 5;

    // first outer loop to iterate through each row
    for (int i = 0; i < 2 * n - 1; i++) {
        // assigning values to the comparator according to the row number
        int comp;
        if (i < n) {
            comp = 2 * (n - i) - 1;
        }
        else {
            comp = 2 * (i - n + 1) + 1;
        }

        // first inner loop to print leading whitespaces
        for (int j = 0; j < comp; j++) {
            printf(" ");
        }

        // second inner loop to print alphabet and inner whitespaces
        for (int k = 0; k < 2 * n - comp; k++) {
            if (k == 0 || k == 2 * n - comp - 1) {
                printf("%c ", k + 'A');
            }
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
         A 
       A   C 
     A       E 
   A           G 
 A               I 
   A           G 
     A       E 
       A   C 
         A

Pattern 56: Hollow Hourglass of Numbers

hard
#include <stdio.h>
int main()
{
    int n = 5;

    // first outer loop to iterate through each row
    for (int i = 0; i < 2 * n - 1; i++) {

        // assigning comparator
        int comp;
        if (i < n) {
            comp = 2 * i + 1;
        }
        else {
            comp = 2 * (2 * n - i) - 3;
        }

        // first inner loop to print leading whitespaces
        for (int j = 0; j < comp; j++) {
            printf(" ");
        }

        // second inner loop to print numbers and inner whitespaces
        for (int k = 0; k < 2 * n - comp; k++) {
            if (k == 0 || k == 2 * n - comp - 1 || i == 0 || i == 2 * n - 2) {
                printf("%d ", k + 1);
            }
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
1 2 3 4 5 6 7 8 9 
 1            7 
   1        5 
     1    3 
       1 
     1    3 
   1        5 
 1            7 
1 2 3 4 5 6 7 8 9 

Pattern 57: Hollow Hourglass of Alphabets

hard
#include <stdio.h>
int main()
{
    int n = 5;

    // first outer loop to iterate through each row
    for (int i = 0; i < 2 * n - 1; i++) {

        // assigning comparator
        int comp;
        if (i < n) {
            comp = 2 * i + 1;
        }
        else {
            comp = 2 * (2 * n - i) - 3;
        }

        // first inner loop to print leading whitespaces
        for (int j = 0; j < comp; j++) {
            printf(" ");
        }

        // second inner loop to print alphabets and inner whitespaces
        for (int k = 0; k < 2 * n - comp; k++) {
            if (k == 0 || k == 2 * n - comp - 1 || i == 0 || i == 2 * n - 2) {
                printf("%c ", k + 'A');
            }
            else {
                printf("  ");
            }
        }
        printf("\n");
    }
    return 0;
}
Output:
 A  B  C  D  E  F  G  H  I 
   A                  G 
      A            E 
         A     C 
            A 
         A     C 
      A           E 
   A                 G 
 A  B  C  D  E  F  G  H  I

Pattern 58: Floyd’s Triangle of Alphabets

easy
#include <stdio.h>

int main()
{
    int rows = 4;
    char n = 'A';

    // Outer loop to print all rows
    for (int i = 0; i < rows; i++) {

        // Inner loop to print alphabet in each row
        for (int j = 0; j <= i; j++) {
            printf("%c ", n++);
        }
        printf("\n");
    }
    return 0;
}
Output:
A 
B C 
D E F 
G H I J

Pattern 59: Mirrored Rhombus Star Pattern

easy
#include <stdio.h>  
int main()  
{  
    int n;  
    printf("Enter the number of rows:\n");  
    scanf("%d", &n);  
    
    for(int i = 1; i <= n; i++)  
    {  
        // Print leading spaces
        for(int j = 1; j < i; j++)  
        {  
            printf(" ");  
        }  
        
        // Print stars
        for(int k = 1; k <= n; k++)  
        {  
            printf("*");  
        }  
        printf("\n");  
    }  
    return 0;  
}
Output:
*****
 *****
  *****
   *****
    *****

Pattern 60: Hollow Mirrored Rhombus Star Pattern

medium
#include <stdio.h>  
int main()  
{  
    int n;  
    printf("Enter the number of rows: \n");  
    scanf("%d", &n);  
    
    for(int i = 1; i <= n; i++)  
    {  
        // Print leading spaces
        for(int j = 1; j < i; j++)  
        {  
            printf(" ");  
        }  
        
        // Print stars and inner spaces
        for(int k = 1; k <= n; k++)  
        {  
            if(i == 1 || i == n || k == 1 || k == n)  
                printf("*");  
            else  
                printf(" ");  
        }  
        printf("\n");  
    }  
    return 0;  
}
Output:
*****
 *   *
  *   *
   *   *
    *****

Pattern 61: Hollow Mirrored Right Triangle Star Pattern

medium
#include <stdio.h>  
  
int main()  
{  
    int n, m = 1;  
    printf("Enter the number of rows: \n");  
    scanf("%d", &n);  
    
    for(int i = n; i >= 1; i--)  
    {  
        // Print leading spaces
        for(int j = 1; j <= i - 1; j++)  
        {  
          printf(" ");  
        }  
        
        // Print stars and inner spaces
        for(int k = 1; k <= m; k++)  
        {  
           if(k == 1 || k == m || m == n)  
                printf("*");  
            else  
                printf(" ");  
        }  
        printf("\n");  
        m++;  
    }  
    return 0;  
}
Output:
     *
   * *
  *  *
 *   *
*****

Pattern 62: Hollow Inverted Right Triangle Star Pattern

easy
#include <stdio.h>  
  
int main()  
{  
    int n;  
    printf("Enter the number of rows: \n");  
    scanf("%d", &n);  
    
    for(int i = n; i >= 1; i--)  
    {  
        // Print stars and inner spaces
        for(int j = 1; j <= i; j++)  
        {  
           if(j == 1 || j == i || i == n)  
                printf("*");  
            else  
                printf(" ");  
        }  
        printf("\n");  
    }  
    return 0;  
}
Output:
*****
*  *
* *
**
*

Pattern 63: Pyramid Pattern with Numbers

medium
#include <stdio.h>  
  
int main()  
{  
    int i, j, n = 5;  // Number of rows (pyramid height) 
    
    // Outer loop to iterate through each row 
    for (i = 0; i < n; i++)  
    {  
        // Inner loop to print leading spaces for alignment 
        for (j = 0; j < n + i; j++)  
        {  
            // Print spaces before the numbers 
            if (j < n - i - 1)  
                printf(" ");  
            // Print decreasing numbers on the left side of the pyramid 
            else if (j < n)  
                printf("%d", n - j - 1);  
            // Print increasing numbers on the right side of the pyramid 
            else  
                printf("%d", j - n + 1);  
        }  
        // Move to the next line after each row is printed 
        printf("\n");  
    }  
    return 0;  
}
Output:
    0
   101
  21012
 3210123
432101234

Pattern 64: Right-Aligned Multiplication Table Pattern

easy
#include <stdio.h>  
  
int main()  
{  
    int i, j, n = 5;  // Number of rows in the pattern

    // Outer loop to iterate through each row
    for (i = 1; i <= n; i++)  
    {  
        int p = 1;  // Initialize multiplier for each row

        // Inner loop to print multiples of the current row number
        for (j = i; j <= n; j++)  
        {  
            // Print the multiple of the row number
            printf("%d ", p * i);  
            p++;  // Increment the multiplier
        }
        
        // Move to the next line after printing all numbers in the current row
        printf("\n");  
    }  
    
    return 0;  
}
Output:
1 2 3 4 5
2 4 6 8
3 6 9
4 8
5

Pattern 65: Right-Aligned Staircase Multiplication Pattern

medium
#include <stdio.h>  

int main()  
{  
    int i, j, n = 5;  // Number of rows in the pattern

    // Outer loop to iterate through each row
    for (i = 1; i <= n; i++)  
    {  
        int p = 1;  // Initialize multiplier for each row

        // Inner loop to print spaces and numbers
        for (j = 1; j <= n; j++)  
        {  
            if (j < i)  
            {  
                // Print spaces to create right alignment
                printf(" ");  
            }  
            else  
            {  
                // Print the multiple of the row number
                printf("%d ", p * i);  
                p++;  // Increment the multiplier
            }  
        }

        // Move to the next line after printing all numbers in the current row
        printf("\n");  
    }  

    return 0;  
}
Output:
1 2 3 4 5
 2 4 6 8
  3 6 9
   4 8
    5

Pattern 66: Triangular Word Expansion Pattern

medium
#include <stdio.h>  

int main()  
{  
    int i, j, n = 9;  // Number of rows in the pattern

    // Outer loop to iterate through each row
    for (i = 0; i < n; i++) {  
        // Inner loop to print characters in each row
        for (j = 0; j <= i; j++) {
            // Conditional checks to print the appropriate letter based on its position
            if (j == 0 || j == 8) {
                printf("M ");
            } else if (j == 1 || j == 3 || j == 5 || j == 7) {
                printf("A ");
            } else if (j == 2 || j == 6) {
                printf("L ");
            } else if (j == 4) {
                printf("Y ");
            }
        }
        // Move to the next line after printing all characters in the current row
        printf("\n");  
    }  

    return 0;  
}
Output:
M
M A
M A L
M A L A
M A L A Y
M A L A Y A
M A L A Y A L
M A L A Y A L A
M A L A Y A L A M

Pattern 67: Triangular Word Expansion Pattern

easy
#include <stdio.h>  

int main()  
{  
    int i, j, n = 5;  // Number of rows in the pattern

    // Outer loop to iterate through each row
    for (i = 0; i < n; i++) {  
        // Inner loop to print characters in each row
        for (j = 0; j <= i; j++) {
            // Using switch-case to print the correct character based on its position
            switch(j) {
                case 0: 
                    printf("I "); 
                    break;
                case 1: 
                    printf("N "); 
                    break;
                case 2: 
                    printf("D "); 
                    break;
                case 3: 
                    printf("I "); 
                    break;
                case 4: 
                    printf("A "); 
                    break;
            }
        }
        // Move to the next line after printing all characters in the current row
        printf("\n");  
    }  

    return 0;  
}
Output:
I
I N
I N D
I N D I
I N D I A

Pattern 68: Zigzag Number Pattern

medium
#include <stdio.h>  

int main()  
{  
    int rows = 5;  // Total number of rows for the pattern
    int i, j;  // Loop variables
    int currentNumber = 1;  // Variable to keep track of the current number to print

    // Outer loop to control the number of rows
    for(i = 1; i <= rows; i++) {  
        int startNumber = currentNumber;  // Store the start number for the current row

        // Inner loop to control the numbers printed in each row
        for(j = 1; j <= i; j++) {
            // Check if the current row number `i` is odd or even
            if(i % 2 == 1) {  
                // If the row is odd, print numbers in ascending order
                printf("%d ", startNumber++);
            } else {
                // If the row is even, print numbers in descending order
                printf("%d ", startNumber + i - j);
            }
        }

        // Update `currentNumber` to the next number to be printed in the next row
        currentNumber += i;

        // Move to the next line after printing the current row
        printf("\n");  
    }  

    return 0;  
}
Output:
1
3 2
4 5 6
10 9 8 7
11 12 13 14 15

Pattern 69: Alternating Character and Number Pattern

easy
#include <stdio.h>  

int main()  
{  
    int alpha = 65;  // ASCII value for 'A'
    int num = 1;     // Starting number to print
    int i, j;        // Loop variables

    // Loop to control the number of rows
    for(i = 1; i <= 7; i++) {  
        // Check if the row number `i` is odd
        if(i % 2 != 0) {
            // If the row number is odd, print alphabet characters
            for(j = 0; j < i; j++) {
                printf("%c ", alpha);  // Print the current character
            }
            alpha++;  // Move to the next character in the alphabet
        } else {
            // If the row number is even, print numbers
            for(j = 0; j < i; j++) {
                printf("%d ", num);  // Print the current number
            }
            num++;  // Increment the number for the next even row
        }

        // Move to the next line after printing the current row
        printf("\n");  
    }  

    return 0;  
}
Output:
A
1 1
B B B
2 2 2 2
C C C C C
3 3 3 3 3 3
D D D D D D D

Pattern 70: Number Pattern

easy
#include <stdio.h>  

int main()  
{  
    int i, j;  // Loop variables

    // Outer loop for rows
    for(i = 0; i < 5; i++) {  
        int num = i * 2 + 1;  // Calculate the starting number for the current row
        
        // Inner loop for columns
        for(j = i; j < 5; j++) {
            printf("%d ", num);  // Print the current number
            num += 2;  // Increment the number by 2 for the next column
        }
        
        printf("\n");  // Move to the next line after printing the current row
    }  
    
    return 0;  
}
Output:
1 3 5 7 9
3 5 7 9
5 7 9
7 9
9

Pattern 71: Odd Right Triangle Star Pattern

easy
#include <stdio.h>  

int main()  
{  
    int rows = 4;       // Number of rows for the pattern
    int columns = 7;   // Number of columns in each row
    int i, j;           // Loop variables

    // Outer loop for rows
    for(i = 1; i <= rows; i++) {  
        // Inner loop for columns
        for(j = 1; j <= columns; j++) {
            // Condition to print stars
            if(j <= 2 * i - 1)
                printf("* ");  // Print star if within the desired range
            else
                printf("  ");  // Print space otherwise
        }
        printf("\n");  // Move to the next line after each row
    }  
    
    return 0;  
}
Output:
*
* * *
* * * * *
* * * * * * *

Pattern 72: Odd Left Triangle Star Pattern

easy
#include <stdio.h>  

int main()  
{  
    int rows = 4;       // Number of rows for the pattern
    int columns = 7;    // Number of columns in each row
    int i, j;           // Loop variables

    // Outer loop for rows
    for(i = 1; i <= rows; i++) {  
        // Inner loop for columns
        for(j = 1; j <= columns; j++) {
            // Condition to print stars
            if(j > columns - (2 * i - 1))
                printf("* ");  // Print star if within the desired range
            else
                printf("  ");  // Print space otherwise
        }
        printf("\n");  // Move to the next line after each row
    }  
    
    return 0;  
}
Output:
            *
        * * *
    * * * * *
* * * * * * *

Pattern 73: Double-Sided Star Pattern

medium
#include <stdio.h>  

int main()  
{  
    int rows = 4;      // Number of rows for the pattern
    int columns = 11;  // Total number of columns for each row
    int i, j;          // Loop variables

    // Outer loop for rows
    for(i = 1; i <= rows; i++) {  
        // Inner loop for columns
        for(j = 1; j <= columns; j++) {
            // Condition to print stars or spaces
            if(j <= 2 * i - 1 || j > columns - 2 * i + 1)
                printf("* ");  // Print star within the range
            else
                printf("  ");  // Print space outside the range
        }
        printf("\n");  // Move to the next line after each row
    }  
    
    return 0;  
}
Output:
*                   *
* * *           * * *
* * * * *   * * * * *
* * * * * * * * * * *

Pattern 74: Right-Aligned Inverted Pyramid of Stars

easy
#include <stdio.h>  

int main()  
{  
    int rows = 4;       // Number of rows for the pattern
    int columns = 7;    // Maximum number of stars in the first row
    int i, j;           // Loop variables

    // Outer loop for rows
    for(i = 1; i <= rows; i++) {  
        // Inner loop for columns
        for(j = 1; j <= columns; j++) {
            // Condition to print stars or spaces
            if(j <= columns - (i - 1) * 2) {
                printf("* ");  // Print star if within the range
            } else {
                printf("  ");  // Print space outside the range
            }
        }
        printf("\n");  // Move to the next line after each row
    }  
    
    return 0;  
}
Output:
* * * * * * *
* * * * *
* * *
*

Pattern 75: Right-Aligned Decreasing Triangle of Stars

medium
#include <stdio.h>  

int main()  
{  
    int rows = 4;      // Number of rows in the pattern
    int columns = 11;  // Total number of columns for the maximum width
    int i, j;          // Loop variables

    // Outer loop: iterates through each row
    for(i = 1; i <= rows; i++) {  
        // Inner loop: iterates through each column
        for(j = 5; j <= columns; j++) {
            // Condition to print stars and spaces
            if(j > 2*i + 2)  
                printf("* ");  // Print a star followed by a space
            else
                printf("  ");  // Print spaces
        }
        printf("\n");  // Move to the next line
    }  
    
    return 0;  
}
Output:
* * * * * * *
    * * * * *
        * * *
            *

Pattern 76: Diamond Border Pattern

medium
#include <stdio.h>  

int main()  
{  
    int rows = 4;      // Number of rows in the pattern
    int columns = 11;  // Total number of columns for the maximum width
    int i, j;          // Loop variables

    // Outer loop: iterates through each row
    for(i = 1; i <= rows; i++) {  
        // Inner loop: iterates through each column
        for(j = 1; j <= columns; j++) {
            // Condition to print stars and spaces
            if(j < columns - 2*i - 1 || j > 2*i + 2)  
                printf("* ");  // Print a star followed by a space
            else
                printf("  ");  // Print spaces
        }
        printf("\n");  // Move to the next line
    }  
    
    return 0;  
}
Output:
* * * * * * * * * * * 
* * * * *   * * * * * 
* * *           * * * 
*                   *

Pattern 77: Alternating Rows Star Pattern

medium
#include <stdio.h>  

int main()  
{  
    int rows = 13;  // Total number of rows in the pattern
    int cols = 13;  // Initial number of columns for the first row
    int i, j;       // Loop variables

    for (i = 1; i <= rows; i++) {  
        if (i % 2 == 1) {  // Check if the row number is odd
            for (j = 1; j <= cols; j++) {
                printf("* ");  // Print stars with space
            }
            cols -= 2;  // Decrease the number of stars for the next odd row
        } else {
            printf("* *");  // Print two stars separated by a space for even rows
        }
        printf("\n");  // Move to the next line
    }  
  
    return 0;  
}
Output:
* * * * * * * * * * * * * 
* *
* * * * * * * * * * * 
* *
* * * * * * * * * 
* *
* * * * * * * 
* *
* * * * * 
* *
* * * 
* *
*

Pattern 78: Desired Pattern

medium
#include <stdio.h>  

int main()  
{  
    int s = 5;  // Initial number of stars to print
    int i, j;   // Loop variables

    for(i = 1; i <= 4; i++) {  // Outer loop to handle the rows
        // Print the row of stars
        for(j = 1; j <= s; j++) {  
            printf("* ");  // Print stars with a space
        }
        printf("\n");  // Move to the next line
        s += 5;  // Increase the number of stars for the next row

        if(i == 4) break;  // Break the loop after the 4th iteration

        // Print the single-star rows
        for(j = 1; j <= i; j++) {  
            printf("* \n");  // Print a single star and move to the next line
        }
    }

    return 0;  
}
Output:
* * * * * 
* 
* * * * * * * * * * 
* 
* 
* * * * * * * * * * * 
* 
* 
* 
* * * * * * * * * * * * * * * *  

Pattern 79: E Type Pattern

medium
#include <stdio.h>  

int main()  
{  
    int s = 4;  // Number of stars in each star row
    int t = 1;  // Counter for single-star rows
    int i, j;   // Loop variables

    for(i = 1; i <= 4; i++) {  // Outer loop for the 4 main sections
        // Print single stars
        for(j = 1; j <= t; j++) {
            printf("*\n");  // Print a single star and move to the next line
        }
        
        t += 1;  // Increment the number of single-star rows

        // Reset the counter if it reaches 3
        if(t == 3) {
            t = 1;
        }

        // Print a row of stars
        for(j = 1; j <= s; j++) {
            printf("* ");  // Print stars with a space
        }
        printf("\n");  // Move to the next line
    }

    return 0;  
}
Output:
* 
* * * * 
* 
* 
* * * * 
* 
* * * * 
* 
* 
* * * * 

Pattern 80: E Type Pattern (2)

hard
#include <stdio.h>  

int main()  
{  
    int s = 4;  // Initial number of stars in each row
    int t = 1;  // Counter for single-star rows
    int i, j;   // Loop variables

    for(i = 1; i <= 4; i++) {  // Outer loop for 4 main sections
        // Print single stars based on the value of t
        for(j = 1; j <= t; j++){ 
            printf("*\n");  // Print a single star and move to the next line
        }
        
        t += 1;  // Increment the number of single-star rows
        
        // Reset t to 1 if it equals 3
        if(t == 3) t = 1;
        
        // Break the loop if i equals 4
        if(i == 4) break;

        // Reduce the number of stars per row if i equals 3
        if(i == 3) s -= 2;

        // Print a row of stars
        for(j = 1; j <= s; j++){ 
            printf("* ");  // Print stars with a space
        }

        // Increase the number of stars for the next row
        s += 4;
        printf("\n");  // Move to the next line
    }

    return 0;  
}
Output:
* 
* * * * 
* 
* 
* * * * * * * * 
* 
* * * * * * * * * * 
* 
* 

Pattern 81: E Type Pattern (3)

medium
#include <stdio.h>  

int main()  
{  
    int k, col = 2;  // `col` determines the number of stars in the first group
    int i, j;        // Loop variables

    // Outer loop runs 3 times
    for(i = 1; i <= 3; i++) {  
        // First inner loop: prints groups of stars
        for(j = 1; j <= i; j++) {
            for(k = 1; k <= col; k++) {
                printf("* ");  // Print stars followed by spaces
            }
            printf("\n");  // Move to the next line after printing a group of stars
        }
        col += 2;  // Increase the number of stars in the next group by 2
        
        if(i == 3) break;  // Stop the loop after completing the third iteration
        
        // Second inner loop: prints 3 single stars vertically
        for(k = 1; k <= 3; k++) printf("*\n");
    }
    
    return 0;  
}
Output:
* * 
* 
* 
* * * * 
* * * * 
* 
* 
* * * * * * 
* * * * * * 
* * * * * * 

Pattern 82: E Type Pattern (4)

medium
#include <stdio.h>  

int main()  
{  
    int rows = 9; // Total number of rows in the pattern
    int i, j;     // Loop variables

    // Outer loop: iterates through each row
    for(i = 0; i < rows; i++) {
        int cols = 1; // Default number of stars in a row

        // Conditional logic to set the number of stars for specific rows
        if(i == 0) cols = 2;      // Row 0 has 2 stars
        else if(i == 2) cols = 4; // Row 2 has 4 stars
        else if(i == 5) cols = 6; // Row 5 has 6 stars

        // Inner loop: prints stars based on the value of `cols`
        for(j = 0; j < cols; j++) {
            printf("* ");
        }
        
        printf("\n"); // Move to the next line after printing stars for each row
    }

    return 0;  
}
Output:
* * 
* 
* * * * 
* 
* 
* * * * * * 
* 
* 
* 

Pattern 83: Z Type Pattern

medium
#include <stdio.h>  

int main()  
{  
    int n = 5; // Size of the pattern (number of rows and columns)
    int i, j;  // Loop variables
    
    // Outer loop: iterates through each row
    for(i = 0; i < n; i++) {
        // Inner loop: iterates through each column
        for(j = 0; j < n; j++) {
            // Condition to print stars or spaces
            if(i == 0 || i == n - 1 || j == n - i - 1) {
                printf("* ");  // Print star
            } else {
                printf("  ");  // Print spaces
            }
        }
        printf("\n"); // Move to the next line after each row
    }
    return 0;  
}
Output:
* * * * * 
      *   
    *     
  *       
* * * * * 

Pattern 84: S Type Pattern

medium
#include <stdio.h>  

int main()  
{  
    int n = 5;  // Size of the pattern (number of rows and columns)
    int i, j;   // Loop variables
    
    // Outer loop: iterates through each row
    for(i = 0; i < n; i++) {
        // Inner loop: iterates through each column
        for(j = 0; j < n; j++) {
            // Condition to print stars or spaces
            if(i == 0 || i == n - 1 || i == n / 2) {
                // Print stars in the first, last, and middle rows
                printf("* ");
            } else if(i < n / 2 && j == 0) {
                // Print stars in the first column for rows above the middle row
                printf("* ");
            } else if(i > n / 2 && j == n - 1) {
                // Print stars in the last column for rows below the middle row
                printf("* ");
            } else {
                // Print spaces everywhere else
                printf("  ");
            }
        }
        printf("\n"); // Move to the next line after each row
    }
    return 0;  
}
Output:
* * * * * 
*         
* * * * * 
        * 
* * * * * 

Pattern 85: N Type Pattern

medium
#include <stdio.h>  

int main()  
{  
    int n = 5;  // Size of the pattern (number of rows and columns)
    int i, j;   // Loop variables
    
    // Outer loop: iterates through each row
    for(i = 0; i < n; i++) {
        // Inner loop: iterates through each column
        for(j = 0; j < n; j++) {
            // Condition to print stars or spaces
            if(j == 0 || j == n - 1 || j == i) {
                // Print stars in the first and last columns or diagonally
                printf("* ");
            } else {
                // Print spaces everywhere else
                printf("  ");
            }
        }
        printf("\n"); // Move to the next line after each row
    }
    return 0;  
}
Output:
*       * 
* *     * 
*   *   * 
*     * * 
*       * 

Pattern 86: Symmetrical Pyramid Pattern with a Decreasing Sequence

medium
#include <stdio.h>  
  
int main()  
{  
    int inputNumber, rows;  
    int i, j;  
    
    printf("Enter the input Number: \n");  
    scanf("%d", &inputNumber);  
    
    rows = 2 * inputNumber - 1; // Calculate the total number of rows needed  
    
    for (i = 1; i <= rows; i++) { // Loop to control the number of rows  
        int relativeRow = i;  
        if (i > inputNumber) {  
            relativeRow = (rows - i + 1); // Adjust for the second half of the pattern  
        }  
        
        for (j = 1; j <= rows; j++) { // Loop to print each number in a row  
            int relativeCol = j;  
            if (j > inputNumber) {  
                relativeCol = (rows - j + 1); // Adjust for the second half of the row  
            }  
            printf("%d ", relativeCol); // Print the calculated number  
        }  
        printf("\n"); // Move to the next row  
    }  
    return 0;  
}
Output:
1 2 3 4 5 4 3 2 1 
1 2 3 4 5 4 3 2 1 
1 2 3 4 5 4 3 2 1 
1 2 3 4 5 4 3 2 1 
1 2 3 4 5 4 3 2 1 
1 2 3 4 5 4 3 2 1 
1 2 3 4 5 4 3 2 1 
1 2 3 4 5 4 3 2 1 
1 2 3 4 5 4 3 2 1

Pattern 87: Diamond Number Pattern with Decreasing Values

hard
#include <stdio.h>  
  
int main()  
{  
    int inputNumber, rows;  
    int i, j;  
    
    printf("Enter the input Number: \n");  
    scanf("%d", &inputNumber);  
    
    rows = 2 * inputNumber - 1; // Calculate the total number of rows needed  
    
    for (i = 1; i <= rows; i++) { // Loop to control the number of rows  
        int relativeRow = i;  
        if (i > inputNumber) {  
            relativeRow = (rows - i + 1); // Adjust for the second half of the pattern  
        }  
        
        for (j = 1; j <= rows; j++) { // Loop to print each number in a row  
            int relativeCol = j;  
            if (j > inputNumber) {  
                relativeCol = (rows - j + 1); // Adjust for the second half of the row  
            }  
            
            int k = relativeRow; // Start with the current row number  
            if (relativeRow > relativeCol) {  
                k = relativeCol; // Use the smaller of the row or column number  
            }  
            
            printf("%d ", k); // Print the calculated number  
        }  
        printf("\n"); // Move to the next row  
    }  
    return 0;  
}
Output:
1 1 1 1 1 1 1 1 1 
1 2 2 2 2 2 2 2 1 
1 2 3 3 3 3 3 2 1 
1 2 3 4 4 4 3 2 1 
1 2 3 4 5 4 3 2 1 
1 2 3 4 4 4 3 2 1 
1 2 3 3 3 3 3 2 1 
1 2 2 2 2 2 2 2 1 
1 1 1 1 1 1 1 1 1

Pattern 88: Two-Part Increasing-Decreasing Number Sequence Pattern

medium
#include <stdio.h>  
  
int main()  
{  
    int num = 3;     // Start number for the increasing sequence  
    int start = 70;  // Start number for the decreasing sequence  
    int n = 4;       // Determines the number of rows for the increasing sequence  
    int i, j;        // Loop control variables  

    for (i = 0; i < 2 * n; i++) {  // Loop through the total rows (increasing + decreasing)  
        int col = (i < n) ? i + 1 : n * 2 - i;  // Calculate the number of columns for the current row  
        
        for (j = 1; j <= col; j++) {  // Inner loop to print numbers in each row  
            if (i < n) {  // For the first n rows (increasing sequence)  
                printf("%d ", num);  
                num += 3;  // Increment by 3 for the next number  
            } else {  // For the last n rows (decreasing sequence)  
                printf("%d ", start);  
                start -= 7;  // Decrement by 7 for the next number  
            }  
        }  
        printf("\n");  // Move to the next line after completing a row  
    }  

    return 0;  
}
Output:
3 
6 9 
12 15 18 
21 24 27 30 
70 63 56 49 
42 35 28 
21 14 
7

Pattern 89: Mixed Vertical and Horizontal Numeric Pattern

medium
#include <stdio.h>  
  
int main()  
{  
    int i, j, k;
    int count = 1; // Initialize count for the horizontal sequence

    for (i = 1; i <= 3; i++) { // Outer loop controls the number of blocks
        for (j = 1; j <= i; j++) { // Inner loop for vertical printing of numbers
            printf("%d\n", i); // Print the current block number vertically
        }

        for (k = 1; k <= i + 1; k++) { // Inner loop for horizontal printing of sequence
            printf("%d ", count); // Print the incremented sequence number
            count++; // Increment the sequence number
        }

        printf("\n"); // Newline after the horizontal sequence
    }

    return 0;  
}
Output:
1
1 2 
2
2
3 4 5 
3
3
3
6 7 8 9 

Pattern 90: F Type Pattern

medium
#include <stdio.h>  
  
int main()  
{  
    int i, j, k;
    
    // Loop for the top part of the pattern
    for(i = 1; i <= 7; i++) {
        // Print stars in decreasing amounts for each line
        for(j = 1; j <= 1 + 2 * (7 - i); j++) {
            printf("* ");
        }
        printf("\n");
        
        // Break the loop after printing the top part
        if(i == 7) break;
        
        // Print stars in increasing amounts for each line
        for(k = 1; k <= i; k++) {
            printf("* ");
        }
        printf("\n");
    }
    
    return 0;  
}
Output:
* * * * * * * * * * * * * 
*
* * * * * * * * * * * 
* *
* * * * * * * * * 
* * *
* * * * * * * 
* * * *
* * * * * 
* * * * * 
* * * 
* * * * * * 
*

Pattern 91: F Type Pattern

medium
#include <stdio.h>  
  
int main()  
{  
    int i, j, k;
    
    // Loop for the top part of the pattern
    for(i = 1; i <= 7; i++) {
        // Print $ symbols in decreasing amounts for each line
        for(j = 1; j <= 1 + 2 * (7 - i); j++) {
            printf("$ ");
        }
        printf("\n");
        
        // Break the loop after printing the top part
        if(i == 7) break;
        
        // Print * symbols in increasing amounts for each line
        for(k = 1; k <= i; k++) {
            printf("* ");
        }
        printf("\n");
    }
    
    return 0;  
}
Output:
$ $ $ $ $ $ $ $ $ $ $ $ $ 
*
$ $ $ $ $ $ $ $ $ $ $ 
* *
$ $ $ $ $ $ $ $ $ 
* * *
$ $ $ $ $ $ $ 
* * * *
$ $ $ $ $ 
* * * * *
$ $ $
* * * * * *
$

Pattern 92: Alternating Case Alphabet Pattern

easy
#include <stdio.h>  
  
int main()  
{  
    int i, j;
    int rows = 5; // Number of rows in the pattern
    char ch = 'a'; // Starting character for the pattern

    for(i = 1; i <= rows; i++) { // Loop through each row
        for(j = 1; j <= i; j++) { // Loop through each character in the row
            // Print character with alternating case
            if ((i + j) % 2 == 1)  
                printf("%c ", ch - 32); // Convert to uppercase
            else  
                printf("%c ", ch); // Keep as lowercase
            
            ch++; // Move to the next character
        }
        printf("\n"); // Move to the next line after each row
    }
    return 0;  
}
Output:
a 
B c 
D e F 
g H i J 
k L m N o

Pattern 93: Alternating Symbol Pattern

easy
#include <stdio.h>  
  
int main()  
{  
    int i, j;
    int rows = 6;  // Number of rows in the pattern
    for(i = 1; i <= rows; i++) {  // Loop through each row
        for(j = 1; j <= i; j++) {  // Loop through each column in the current row
            if(i % 2 == 0) {  // Check if the row number is even
                printf("$ * ");  // Print "$ * " for even rows
            } else {
                printf("* ");  // Print "* " for odd rows
            }
        }
        printf("\n");  // Move to the next line after finishing the current row
    }
    return 0;  
}
Output:
* 
$ * $ * 
* * * 
$ * $ * $ * $ * 
* * * * * 
$ * $ * $ * $ * $ * $ * 

Pattern 94: Right-Aligned Alternating Symbol Triangle

medium
#include <stdio.h>

int main()  
{  
    int i, j;
    int rows = 6;  // Total number of rows in the pattern

    for(i = 1; i <= rows; i++) {  // Loop through each row
        // Print leading spaces for right alignment
        for(j = 1; j <= rows - i; j++) {
            printf("  ");  // Two spaces for alignment
        }
        // Print alternating symbols
        for(j = 1; j <= i; j++) {
            if(j % 2 == 0) {
                printf("$ ");  // Print dollar sign for even position
            } else {
                printf("* ");  // Print asterisk for odd position
            }
        }
        printf("\n");  // Move to the next line after each row
    }
    
    return 0;  
}
Output:
          * 
        * $ 
      * $ * 
    * $ * $ 
  * $ * $ * 
* $ * $ * $ 

Pattern 95: Right-Aligned Inverted Pattern with Alternating Symbols

medium
#include <stdio.h>

int main()  
{  
    int i, j;
    int rows = 6; // Total number of rows in the pattern
    
    for(i = 1; i <= rows; i++) { // Loop through each row
        // Print leading spaces for right alignment
        for(j = 1; j <= i; j++) {
            printf("  "); // Two spaces for alignment
        }
        // Print alternating symbols
        for(j = 1; j <= rows - i; j++) {
            if(j % 2 != 0)
                printf("$ "); // Print dollar sign for odd positions
            else
                printf("* "); // Print asterisk for even positions
        }
        printf("\n"); // Move to the next line after each row
    }
    
    return 0;  
}
Output:
  $ * $ * $ 
    $ * $ * 
      $ * $ 
        $ * 
          $ 

Pattern 96: Right-Aligned Inverted Pattern with Alternating Symbols (2)

medium
#include <stdio.h>

int main()  
{  
    int i, j;
    int rows = 7; // Total number of rows in the pattern
    
    for(i = 1; i <= rows; i++) { // Loop through each row
        // Print leading spaces for right alignment
        for(j = 1; j <= i; j++) {
            printf("  "); // Two spaces for alignment
        }
        // Print alternating symbols
        for(j = 1; j <= rows - i; j++) {
            if(i % 2 != 0)
                printf("$ "); // Print dollar sign for odd rows
            else
                printf("* "); // Print asterisk for even rows
        }
        printf("\n"); // Move to the next line after each row
    }
    
    return 0;  
}
Output:
  $ $ $ $ $ $ 
    * * * * * 
      $ $ $ $ 
        * * * 
          $ $ 
            * 

Pattern 97: * and _ Symbols Pattern

medium
#include <stdio.h>

int main()  
{  
    int i, j;

    // Loop through the number of rows
    for(i = 1; i <= 4; i++) {
        // Print stars in the first row of each iteration
        for(j = 1; j <= 2 * i; j++) {
            printf("* ");
        }
        printf("\n");
        
        // Print alternating stars and underscores in the second row of each iteration
        for(j = 1; j <= 2 * i; j++) {
            printf("* ");
            printf("_ ");
        }
        printf("\n");
    }
    
    return 0;  
}
Output:
* * 
* _ * _ 
* * * * 
* _ * _ * _ * _ 
* * * * * * 
* _ * _ * _ * _ * _ * _ 
* * * * * * * * 
* _ * _ * _ * _ * _ * _ * _ * _ 

Pattern 98: E Type Pattern (5)

medium
#include <stdio.h>

int main()  
{  
    int i, j, k, l;

    // Loop to generate the top part of the pattern
    for(i = 1; i <= 5; i++) {
        // Print stars in the current row, increasing with each iteration
        for(j = 1; j <= (2 * (i - 1) + 1); j++) {
            printf("* ");
        }
        printf("\n");
        
        // Break out of the loop when i equals 5 to prevent further rows
        if(i == 5) break;
        
        // Loop to generate the middle part of the pattern
        for(k = 1; k <= i; k++) {
            // Print stars in a square pattern of size i
            for(l = 1; l <= i; l++) {
                printf("* ");
            }
            printf("\n");
        }
    }
    
    return 0;  
}
Output:
* 
* 
* * * 
* * 
* * 
* * * * * 
* * * 
* * * 
* * * 
* * * * * * * 
* * * * 
* * * * 
* * * * 
* * * * 
* * * * * * * * * 

Pattern 99: E Type Pattern (6)

medium
#include <stdio.h>  

int main()  
{  
    int i, j, k, l;

    // Loop to generate the pattern
    for(i = 1; i <= 5; i++) {
        // Print the top part of the pattern
        for(j = 1; j <= (2 * (i - 1) + 1); j++) {
            if(j % 2 == 0) {
                printf("$ ");
            } else {
                printf("* ");
            }
        }
        printf("\n");
        
        // Break the loop after printing the top part
        if(i == 5) break;
        
        // Print the middle part of the pattern
        for(k = 1; k <= i; k++) {
            // Print stars in a square pattern
            for(l = 1; l <= i; l++) {
                printf("* ");
            }
            printf("\n");
        }
    }
    
    return 0;  
}
Output:
* 
* 
* $ * 
* * 
* * 
* $ * $ * 
* * * 
* * * 
* * * 
* $ * $ * $ * 
* * * * 
* * * * 
* * * * 
* * * * 
* $ * $ * $ * $ * 

Pattern 100: E Type Pattern (7)

hard
#include <stdio.h>  

int main()  
{  
    int i, j, k, l;

    // Loop for generating the pattern
    for(i = 1; i <= 5; i++) {
        // Determine the number of characters to print
        int count = (i == 1) ? i : (i - 1) * 3;
        
        // Print alternating stars and dollar signs
        for(j = 1; j <= count; j++) {
            if(j % 2 == 0) {
                printf("$ ");
            } else {
                printf("* ");
            }
        }
        printf("\n");
        
        // Break the loop after printing the top part
        if(i == 5) break;
        
        // Print stars in a grid pattern
        for(k = 1; k <= i; k++) {
            for(l = 1; l <= i; l++) {
                printf("* ");
            }
            printf("\n");
        }
    }
    
    return 0;  
}
Output:
* 
* 
* $ * 
* * 
* * 
* $ * $ * $ 
* * * 
* * * 
* * * 
* $ * $ * $ * $ * 
* * * * 
* * * * 
* * * * 
* * * * 
* $ * $ * $ * $ * $ * $ 

Pattern 101: Number Pyramid with Increasing Digits

easy
#include <stdio.h>  // Include the standard input/output library

int main() {
    int i, j, k;  // Declare integer variables i, j, and k for loop control

    // Outer loop to control the number of rows (from 1 to 5)
    for(i=1; i<=5; i++) {
        
        // First inner loop to print '1's depending on the row number
        for(j=1; j<=5; j++) {
            if(j>i)  // If the column number (j) is greater than the row number (i)
                printf("%d", 1);  // Print '1'
        }

        // Second inner loop to print increasing numbers starting from 1
        for(k=1; k<=i; k++) {
            printf("%d", k);  // Print the value of k (1 to i)
        }

        printf("\n");  // Move to the next line after each row is printed
    }

    return 0;  // Return 0 to indicate successful execution
}
Output:
11111
11112
11123
11234
12345