patternprogram_157 softethics

Pattern 157

C

#include<stdio.h>

int main()
{
  int m=0;

  int p_height=5;   //change  value to increase or decrease
  the size of piramid


  int p_space=p_height-1;

  int i,j,k;


  for(i=0; i<p_height; i++)
  {
    for(j=p_space; j>i; j--)
    {
      printf(" ");
    }
    for(k=0; k<=m; k++)
    {
      printf("%c",m+65);  // 65 is the ASCII of 'A'
    }
    m+=2;
    printf("\n");
  }
  return 0;
}

C++

Java

C#

Python

Tutorial (YouTube)

5 1 vote
Rate this Program
Subscribe
Notify of
guest


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