Number Pattern 59 – Rectangle pattern in C programming

Spread the love

Number Pattern 59-Rectangle pattern in C programming

Rectangle pattern in C programming

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

1  2  3  4  5  
16          6  
15          7  
14          8  
13 12 11 10 9

The C program for Pyramid pattern is as follows:

#include <stdio.h>

int main()
{
  int a,b,c=6,l=13,m=16;
  for(a=1;a<=5;a++)
  {
    for(b=1;b<=5;b++)
    {
      if(a==1)
        printf("%-3d",b);
      else if(b==5)
        printf("%-3d",c++);
      else if(a==5)
        printf("%-3d",l--);
      else if(b==1)
        printf("%-3d",m--);
      else
        printf("   ");
    }
    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