Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to print pyramid of * (starts)

Posted By: Billie Young     Category: C Programming     Views: 11648

WRITE A PROGRAM TO GENERATE FOLLOWING FIGURE OF N LINES.
INPUT N FROM KEYBOARD.

______*
____* * *
__* * * * *
* * * * * * *

consider space in place of line

Code for Program to print pyramid of * (starts) in C Programming

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
        int i,n,j;
        clrscr();

        printf("\n Please Give The Value of N:  ");
        scanf("%d",&n);
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=n-i;j++)
            printf("  ");
            for(j=1;j<=2*i-1;j++)
            printf(" *");
        printf("\n");
        }

        getch();
    }




****************************** OUTPUT *********************************




 Please Give The Value of N:  7


             *
           * * *
         * * * * *
       * * * * * * *
     * * * * * * * * *
   * * * * * * * * * * *
 * * * * * * * * * * * * *


**********************************************************************
  
Share: 


Didn't find what you were looking for? Find more on Program to print pyramid of * (starts) Or get search suggestion and latest updates.

Billie Young
Billie Young author of Program to print pyramid of * (starts) is from St Louis, United States.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!