program for printing pyramid




#include<stdio.h>
#include<conio.h>
void main()
{
        int i,j,k,n;
        clrscr();
        printf("enter the number=");
        scanf("%d",&n);
        for(i=1;i<=n;i++)
        {
        for(j=i;j<=n-1;j++)
        {
        printf(" ");
        }
        for(k=1;k<=i;k++)
        {
        printf("*");
        }
        for(k=2;k<=i;k++)
        {
        printf("*");
        }
        printf("\n");
        }
        getch();
        }



                                           



                                 Output

enter the number=6
         *
       ***
     *****
   *******
 *********
***********

Comments

Popular posts from this blog

Program for calculating Simple Interest using the concept of Default Arguments

Program: Maximum number in three numbers in visual basic

Program for Checking whether the given number is Palindrome or not