Silahkan Melihat Tutorial di website kami dengan nyaman ENJOY YOUR LIFE ☕

How To Make Continuous Vertical-Horizontal Number Pyramid

Q. Write a C program of Continuous Vertical Horizontal Number Pyramid design as:

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

Ans.

Before we starting the coding of above number pyramid design, let's focus the following source image of above pyramid:
Showing flow of data in Number Pyramid Design
Figure: Showing flow of data in Number Pyramid Design

So, In above pyramid design it is too easy to making every rows and columns. let's starting the writing source code.

/*c program for continuous vertical horizontal number pyramid*/
#include<stdio.h>
int main()
{

 int r,c,a=1,b,y,z=5;
 for(r=1; r<=5; r++, a=a+7-r, z--)
 {
   b=a;
   y=z;
   for(c=1; c<=r; c++, b=b-y++)
      printf(" %d ",b);
   printf("\n");
 }
 getch();
 return 0;
}

/**********************************************************
The output of above program would be:
***********************************************************/
Output of How To Make Continuous Vertical Horizontal  Number Pyramid C Program
Figure: Screen shot of How To Make Continuous Vertical Horizontal
 Number Pyramid C Program

You might also like:

  1. Big list of 98+ C Pyramid Programs
  2. Latest Asking Pyramid Programs List




0 komentar:

Post a Comment

How To Make Continuous Vertical-Horizontal Number Pyramid