program for print pyramid

#include<stdio.h>
void main()
{
  int x=1,a,n=1,i=0;
  printf("enter how long print pyramid");
  scanf("%d",&a);
  printf("%2d",x);
  printf("\n");
  while(n<a)
  {
   i=0;
   while(i<=n)
  {
      x=x+1;
   printf("%2d",x);
   i++;
  }
  printf("\n");
  n++;
  }
}

Comments

Popular posts from this blog

BYTE STUFFING PROGRAM USING C

Rotate a matrix 270 degree AntiClockWise

Finding the length of connected cells of 1's (regions) in an matrix of 1's and 0's