Input rows: 5
*
***
*****
*******
*********
/**
* C program to print equilateral triangle or pyramid star pattern
*/
#include <stdio.h>
int main()
{
int i, j, rows;
/* Input number of rows to print */
printf("Enter number of rows : ");
scanf("%d", &rows);
/* Iterate through rows */
for(i=1; i<=rows; i++)
{
/* Print leading spaces */
for(j=i; j<rows; j++)
{
printf(" ");
}
/* Print star */
for(j=1; j<=(2*i-1); j++)
{
printf("*");
}
/* Move to next line */
printf("
");
}
return 0;
}
Code Example |
---|
C :: create role in psql with password |
C :: Example of Implementation of a pointer to an array in C: |
C :: fwrite in c |
C :: ft_putchar |
C :: bootsrap textbox |
C :: Bootstrap textarea from |
C :: c strstr |
C :: doble puntero en c |
C :: enregistrement en c |
C :: Bitwise Operators in C language |
C :: malloc |
C :: mongo script to find collection size in database |
C :: variable swap in c |
C :: debian unhold packages |
C :: Initialization of a 3d array in c |
C :: adding a node in the front on a linked list |
C :: print only last 3 number float in c |
C :: command args c |
C :: print the name of a file c |
C :: C Input and Output Array Elements |
C :: realloc in c |
C :: How to send an array through a pipe |
C :: type cast in c |
C :: find all hyperlinks <a in p tag |
C :: anthracnose pronounce |
C :: print integer to stdout using write or putchar? |
C :: Parsing using strtok |
C :: python project script run |
C :: syntax of for loop in c stack over flow |
C :: increment c |