Friday, August 27, 2010

Piramid

#include<stdio.h>
#include<conio.h>

void main()
{
   int i,j,k,n;
   printf("enter the no. '<20'");
   scanf("%d",&n);

   for(i=1;i<=n;i++)
   {
      for(j=1;j<=n-i;j++)
      {
          printf(" ");
      }
      for(k=1;k<=2*i-1;k++)
      {
         printf("*");
      }
      printf("\n");
   }

   getch();
}
Output-->

No comments: