-->

C program to print the given number pattern 121

/* C program to print the given number pattern 121
1
121
12321
1234321
123454321
 */
#include <stdio.h>
#include<conio.h>
void main()
{
    int i, j, N;

    printf("Enter rows: ");
    scanf("%d", &N);

    for(i=1; i<=N; i++)
    {
        // Prints the first part of the pattern
        for(j=1; j<=i; j++)
        {
            printf("%d", j);
        }
        // Prints the second part of the pattern
        for(j=i-1; j>=1; j--)
        {
            printf("%d", j);
        }
        printf("\n");
    }
    getch();
}
                                                                                   source:codeforwin.org

C program to print alphabetical character pattern A

/**
 C program to print alphabetical character pattern A
A
AB
ABC
ABCD
ABCDE
 */
#include <stdio.h>
#include<conio.h>
void main()
{

int i, j;
for (i=1;i<=5;i++)
{
for (j=0;j<i;j++) {
printf("%c", 'A'+ j);
}
printf("\n");
}
return 0;
}

C program to print alphabetical pattern ABCDE

/**
 C program to print alphabetical  pattern ABCDE
ABCDE
ABCD
ABC
AB
A
 */
#include <stdio.h>
#include<conio.h>
void main()
{

int i, j;
for (i=5;i>=1;i--) {
for (j=0;j<i;j++) {
printf("%c", 'A'+ j);
}
printf("\n");
}
getch();
}

C program to print square numeric pattern 12345

**
 * C program to print square numeric pattern
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

 */
#include <stdio.h>
#include<conio.h>
void main()
{
    int i, j, N;

    /* Input number of rows from user */
    printf("Enter number of rows: ");
    scanf("%d", &N);

    /* Iterate over each row */
    for(i=1; i<=N; i++)
    {
                /* Print given number in next line */
                printf("1 2 3 4 5\n");
   
    }

    getch();
}

C program to print box number pattern with alternative 2 and 0

/**
 *
 2 2 2 2 2
 0 0 0 0 0
 2 2 2 2 2
 0 0 0 0 0
 2 2 2 2 2
 */
#include <stdio.h>
#include<conio.h>
void main()
{
    int rows, cols, i, j;

    /* Input rows and columns from user */
    printf("Enter number of rows: ");
    scanf("%d", &rows);
    printf("Enter number of columns: ");
    scanf("%d", &cols);

    for(i=1; i<=rows; i++)
    {
        for(j=1; j<=cols; j++)
        {
            if((i%2)!=0)
            printf("2");
            else
            printf("0");
        }

        printf("\n");
    }

    getch();
}

C program to print box number pattern with alternative 1 and 0

/**
 * C program to print box number pattern
 1 1 1 1 1
 0 0 0 0 0
 1 1 1 1 1
 0 0 0 0 0
 1 1 1 1 1
 */
#include <stdio.h>
#include<conio.h>
void main()
{
    int rows, cols, i, j;

    /* Input rows and columns from user */
    printf("Enter number of rows: ");
    scanf("%d", &rows);
    printf("Enter number of columns: ");
    scanf("%d", &cols);

    for(i=1; i<=rows; i++)
    {
        for(j=1; j<=cols; j++)
        {
            printf("%d", (i%2));
        }

        printf("\n");
    }

    getch();
}

                                                                                                                  source: codeforwin.org

C program to print square numeric pattern

/**
 * C program to print square numeric pattern
   0 2 0 2 0
   0 2 0 2 0
   0 2 0 2 0
   0 2 0 2 0
   0 2 0 2 0

 */
#include <stdio.h>
#include<conio.h>
void main()
{
    int i, j, N;

    /* Input number of rows from user */
    printf("Enter number of rows: ");
    scanf("%d", &N);

    /* Iterate over each row */
    for(i=1; i<=N; i++)
    {
                /* Print given number in next line */
                printf("0 2 0 2 0\n");
   
    }

    getch();
}