patternprogram_79 softethics

Pattern 79

C

#include <stdio.h>
int main()
{

  int i,j,k;


  int d1=1; // for printing

  int n=4; //size

  int d2=(n*n)+1;

  for(i=n; i>=1; i--)
  {
    /* for 2nd part */
    for(k=1; k<=i; k++)
    {
      printf("%d ",d2);
      d2++;
    }
    d2--;  // decrement to get last printed value

    d2=d2-((i-1)*2); // used to set next print value

    printf("\n");
  }
}

C++

Java

C#

Python

5 2 votes
Rate this Program
Subscribe
Notify of
guest


0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments