pyramid using c

#include<stdio.h> 
int main() 
{
int i,j,n; 
printf("ENTER THE NUMBER OF ROWS YOU WANT TO PRINT * PYRAMID PATTERN\n"); 
scanf("%d", &n); 
for(i = 1 ; i <= n ; i++) 
{
    for (j = 1 ; j <= 2*n-1 ; j++) 
{
      if (j >= n-(i-1) && j <= n+(i-1)) 
      { printf("*"); }
      else 
      {printf(" "); } 
} 
printf("\n");
}

3.67
6
Des Wilson 70 points

                                    #include &lt;stdio.h&gt;

int main(){
    int i,j,n,;//declaring variables

    /*
    At first half pyramid
    *
    **
    ***
    ****
    *****
    ******
    *******
    ********
    */
    printf(&quot;Enter rows: \n&quot;);
    scanf(&quot;%d&quot;,&amp;n);

    printf(&quot;half pyramid\n\n&quot;);
    for(i=0;i&lt;n;i++){ //loop for making rows
        for(j=0;j&lt;i;j++){ //loop for making stars. Here &quot;i&quot; is row number and n is total row number. so for making 1 star after 1 star you've to put variable &quot;i&quot;
            printf(&quot;* &quot;);
        }
        //printing new line
        printf(&quot;\n&quot;);
    }

    printf(&quot;\n\n&quot;);





    /*
    making full pyramids

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

    */
    printf(&quot;full pyramid\n\n&quot;);
    //the first loop is for printing rows
    for(i=1;i&lt;=n;i++){
        //loop for calculating spaces
        for(j=1;j&lt;=(n-i);j++){ //to calculate spaces I use totalRows-rowNo formula
            printf(&quot; &quot;);
        }

        //loop for calculating stars
        for(j=1;j&lt;=((2*i)-1);j++){ //using the formula &quot;2n-1&quot;
            printf(&quot;*&quot;);
        }
        //printing a new line
        printf(&quot;\n&quot;);
    }





    return 0;


}

3.67 (6 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
number pyramid pattern in c pyramids in c pyramid in c using for loop program for build a pyramid in c pattern pyramid in c pyramid with no in c how to create pyramid pattern in c pyramid shape in c pyramid number pattern in c pyramid pattern printing in c program to display a full pyramid in c alphabet pyramid pattern in c Integrated pyramid with number in c pyramid shape by C pyramid pattern printing in c banglas pyramid c programm pyramid print in c how to make a letters pyramid in c Write a C program to construct a pyramid of numbers. right pyramid using c pyramids using c pyramid using c Pyramid Patterns in c Text Pyramid Patterns in c Pyramid Patterns in c printing pyramids in c c program to build pyramid number pyramid with * program in c number pyramid program in c pyramids pattern in c pyramid code in c c programming code to create pyramid and pattern c program pyramid number pattern how to print a pyramid in C how to make pyramid in c pyramid in c code c program pyramid c program to print numeric pyramid how to make a pyramid in c c program to print pyramid pattern of stars pyramid in C programming print a pyramid in c program to print pyramid of * using c C Program to Print Pyramids and Patterns * pyramid in c UNDERSTAND PYRAMIDS IN C create pyramids with C c program for pyramids c program for numerical pyramid c programming pyramid c program to print pyramid do while loop c program to print * pyramid c program to print pyramid printing pyramid in c studytonight printing pyramid in c name pyramid pattern in c pyramid in c pyramid alphabet pattern in c c program to get invereted pyramid print pyramid in c all pyramids c programming printing numbers in a pyramid pattern in c pyramid * pattern in c c program to print pyramid using * programm to print pyramid in c print number pyramid in c Programs for printing pyramid patterns in c pyramid print function in c pyramid print functionin c print a pyramidusing c how to print pyramid in C how to make a pyramid with character in C c program to print pyramid pattern of numbers write a program to print pyramid of numbers in c print pyramid numbers in c pyramid program in c pyramid pattern in c using numbers pyramid pattern in c pattern questions in c pattern in c print the following pattern pattern printing half pyramid in c pyramid towaer in c petten in c how to make pascal's triangle using C print drawing in c Full Pyramid of Numbers floyd's triangle in c pattern program in c number pattern programs in c with explanation pattern code in c write the program to generate the following series triangle c pattern example pascal triangle c program print asterick in C pyramid c program trinagle pattren in c pyramid pogram Print pyramid pattern patterns in c c program for pyramid of stars c programming for pyramid Write a program to print the following pattern. * * * * * * * * * * * * * * * star triangle in c c pattern programs pattern programs in c DON STORM PYRAMID PATTERN IN C PROGRAMMING GREPPERS DONSTORM PYRAMID PATTERN IN C PROGRAMMING GREPPERS DON STORM PYRAMID PATTERN IN C PROGRAMMING DONSTORM PYRAMID PATTERN IN C PROGRAMMING c programming print pattern pyramid
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source