C PROGRAMMING

write a c program to print pyramid pattern of given rows

#include<stdio.h>
int main()
{
int Rows, i, j, k = 0;
printf("Please Enter the Number of Rows: ");
scanf("%d", &Rows);
printf("Your Pyramid Pattern is here n n");
for ( i = 1 ; i <= Rows; i++ )
{
for ( j = 1 ; j <= Rows-i; j++ )
{
printf(" ");
}
while (k != (2 * i - 1))
{
printf("*");
k++;
}
k = 0;
printf("n");
}
return 0;
getch();
}

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button