pyramid using c

Solutions on MaxInterview for pyramid using c by the best coders in the world

showing results for - "pyramid using c"
Niko
16 Nov 2019
1#include<stdio.h> 
2int main() 
3{
4int i,j,n; 
5printf("ENTER THE NUMBER OF ROWS YOU WANT TO PRINT * PYRAMID PATTERN\n"); 
6scanf("%d", &n); 
7for(i = 1 ; i <= n ; i++) 
8{
9    for (j = 1 ; j <= 2*n-1 ; j++) 
10{
11      if (j >= n-(i-1) && j <= n+(i-1)) 
12      { printf("*"); }
13      else 
14      {printf(" "); } 
15} 
16printf("\n");
17}
Juan Diego
07 Jan 2020
1#include <stdio.h>
2
3int main(){
4    int i,j,n,;//declaring variables
5
6    /*
7    At first half pyramid
8    *
9    **
10    ***
11    ****
12    *****
13    ******
14    *******
15    ********
16    */
17    printf("Enter rows: \n");
18    scanf("%d",&n);
19
20    printf("half pyramid\n\n");
21    for(i=0;i<n;i++){ //loop for making rows
22        for(j=0;j<i;j++){ //loop for making stars. Here "i" is row number and n is total row number. so for making 1 star after 1 star you've to put variable "i"
23            printf("* ");
24        }
25        //printing new line
26        printf("\n");
27    }
28
29    printf("\n\n");
30
31
32
33
34
35    /*
36    making full pyramids
37
38        *
39       ***
40      *****
41     *******
42    *********
43   ***********
44
45    */
46    printf("full pyramid\n\n");
47    //the first loop is for printing rows
48    for(i=1;i<=n;i++){
49        //loop for calculating spaces
50        for(j=1;j<=(n-i);j++){ //to calculate spaces I use totalRows-rowNo formula
51            printf(" ");
52        }
53
54        //loop for calculating stars
55        for(j=1;j<=((2*i)-1);j++){ //using the formula "2n-1"
56            printf("*");
57        }
58        //printing a new line
59        printf("\n");
60    }
61
62
63
64
65
66    return 0;
67
68
69}
70
queries leading to this page
c program to print pyramid using 2apyramid pogram 2a pyramid in cpyramid shape in cpyramid pattern printing in cwrite the program to generate the following series trianglepyramids in cprint a pyramid in cprint pyramid numbers in chow to print pyramid in cpyramid pattern in cdon storm pyramid pattern in c programming grepperspyramid c programprint pyramid in c with number of 2aprinting pyramid in c studytonighthow to print a pyramid in cright pyramid using cprint pyramid patternpattern pyramid in cwrite a program to print the following pattern 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2apyramid printing in cpyramid towaer in cwrite a c program to construct a pyramid of numbers program to print pyramid using 2a in cpatterns in cnumber pattern programs in c with explanationdisplay pyramid in cpyramid using ccreate pyramids with cpyramid pattern in c using numbersprint pyramid pattern in cc pyramid programintegrated pyramid with number in ctrinagle pattren in cpyramid number pattern in cc print pyramidprinting pyramids in cc pattern examplec program to print 2a pyramidpascal triangle c programfull pyramid of numberspetten in cdon storm pyramid pattern in c programmingpattern code in chow to draw pyramid step by step in cprint number pyramid in cprinting numbers in a pyramid pattern in cstar triangle in cwrite a program to print pyramid of numbers in cprogram for build a pyramid in call pyramids c programmingpyramid in c programmingprinting pyramid in cpattern in cdonstorm pyramid pattern in c programming greppersc program to print pyramids and patternshow to make a pyramid in cpyramid pattern printing in c banglasprint the following patternname pyramid pattern in cpyramid in c using for loopc program to print pyramid do while loopc programming code to create pyramid and patternpyramid patterns in cc print pyramid patternpattern printingpyramids of 2a in cpattern questions in cpyramid shape by cc program to print numeric pyramidpyramid with no in chow to make pascal 27s triangle using csingle number pyramid pattern in cprint drawing in c pyramid patterns in cpyramid code in cnumber pyramid with 2a program in cc program to print pyramid pattern of numbershow to make a letters pyramid in cprint a pyramidusing cunderstand pyramids in cnumber pyramid pattern in cprogram to print number pyramid in cprograms for printing pyramid patterns in cc program to print pyramid pattern of starsprogram to display a full pyramid in cc program for pyramidc program for numerical pyramidfloyd 27s triangle in c alphabet pyramid pattern in cpyramid alphabet pattern in cprogramm to print pyramid in cpattern program in cprogram to print pyramid of 2a using cc program to print pyramidpyramid 2a pattern in ctext pyramid patterns in cc programming pyramidpyramid in c codefull pyramid using 2a in cdonstorm pyramid pattern in c programmingc programming print pattern pyramidhow to create pyramid pattern in cpyramid print in cc program for pyramidsc program to build pyramidpyramids using cpyramid print functionin cc program for pyramid of starsprogram to print full pyramid using 2a in cc programming for pyramidprint asterick in cnumber pyramid program in chalf pyramid in cpyramid c programmingc program pyramid number patternpyramid in cprint pyramid in cmake pyramid in cfull pyramid of 2a in cdraw a paater of pyramid in cpyramid print function in cpyramids pattern in chow to make a pyramid with character in chow to print pyramid pattern in cc program to print pyramid pattern of abchow to create pyramid in cc program pyramidc program to get invereted pyramidprint 2a pyramid in cpyramid program in cpyramid c programmhow to make pyramid in cc pattern programspattern programs in cpyramid using c