Answers for "c programming print pattern pyramid"

C
2

c programming print pattern pyramid

#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");
}
Posted by: Guest on January-21-2021
1

asterisk pyramid c

#include <stdio.h>
int main() {
   int i, j, rows;
   printf("Enter the number of rows: ");
   scanf("%d", &rows);
   for (i = 1; i <= rows; ++i) {
      for (j = 1; j <= i; ++j) {
         printf("* ");
      }
      printf("\n");
   }
   return 0;
}
Posted by: Guest on December-06-2020
1

half pyramid in c

#include <stdio.h>
#define N 5
int main()
{
	int i,j;
	for(i=1;i<=N;i++)
		{
  			for(j=1;j<=i;j++)
    		printf("*");
  
  		printf("\n");
		}
  return 0;
}
Posted by: Guest on November-10-2020
0

c programming print pattern pyramid

#include <stdio.h>   
int main()  
{  
    int height,space,i,j,k;  
    printf("Enter the height of the triangle: ");  
    scanf("%d",&height);  
    space=height;  
   for( i=1;i<=height;i++)  
   {  
       for( j=1;j<space-1;j++)  
       {  
           printf(" ");  
       }  
       for( k=1;k<=2*i-1;k++)  
       {  
         printf("*");  
       }  
       space--;  
     
      printf("\n");  
    }  
    return 0;  
}
Posted by: Saba Techatom on May-09-2022

Code answers related to "c programming print pattern pyramid"

Code answers related to "C"

Browse Popular Code Answers by Language