patternprogram_401 softethics

Pattern 401

C

#include<stdio.h>

#include<math.h>
int main()
{
  int size=4;
  int i,j,k;
  int p=1;

  for(i=size; i>=-size; i--)
  {
    for(j=1; j<=abs(i); j++)
    {
      printf(" ");
    }

    p=1;
    for(k=size; k>=abs(i); k--)
    {

      printf("%d ",p);

      if(i>=0)
        p++;
      else
        p+=2;

    }



    printf("\n");
  }
  return 0;
}

C++

Java

C#

Python

0 0 votes
Rate this Program
Subscribe
Notify of
guest


0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
reCaptcha Error: grecaptcha is not defined