Number Pattern 62 – Cross pattern in C programming

Spread the love

Number Pattern 62-Cross pattern in C programming

Cross pattern in C programming

In this program, we will see the Cross pattern numbers in C programming language. Please look into the program.

1     1
 2   2 
  3 3  
   4   
  3 3  
 2   2 
1     1

The C program for Cross pattern is as follows:

#include<stdio.h>

int main()
{
    int a,b,c=1;
    int m[7][7]={0};
    for(a=1;a<=7;a++)
    {
        for(b=1;b<=7;b++)
            if(b==a || 8-a==b) 
                m[a-1][b-1]=c;
            if(a<4) c++;
            else --c;

    }
    for(a=0;a<7;a++)
    {
        for(b=0;b<7;b++)
        {
            if(m[a][b]==0)
                printf(" ");
            else
                printf("%d",m[a][b]);
        }
        printf("n");
    }
 getch();
    return 0;
}

Number Series Programs in C programmming

Star Pattern Programs in C programmming

Number Pattern Programs in C programmming

Alphabet Pattern Programs in C programmming


Spread the love

Leave a Comment