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

C Pyramid Number Pattern

Q. Write a C program to print the following C Pyramid Number Pattern program as:

     11
     11 10 11
     11 10 9 10 11
     11 10 9  8  9 10 11

Ans.


/* c pyramid number pattern program source code*/
#include<stdio.h>
int main()
{
 int r,c,num=4,p,q=12,z;
 for(r=1; r<=num; r++,q--)
 {
   for(c=1,p=11; c<=r; c++,p--)
      printf(" %d",p);
   for(c=1,z=q; c<r; c++,z++)
      printf(" %d",z); 
   printf("\n");
 }
 getch();
 return 0;
}

/****************************************
The output of above C pyramid number pattern program as:
*****************************************/
Output of C pyramid number pattern program
Figure: Screen shot for C pyramid number pattern program

You might also like to read:

  1. Big list of 98+ C Pyramid Programs
  2. Latest user asking pyramid programs list




0 komentar:

Post a Comment

C Pyramid Number Pattern