Answers for "half pyramid in c"

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

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

Code answers related to "C"

Browse Popular Code Answers by Language