Code For Printing Hurt
Code For Printing Hurt
h>
#include<conio.h>
int main()
{
int n, x, y, s;
int i, j, rows, columns;
printf("Enter number of rows to show the star pattern: ");
scanf("%d",&n);
printf("Enter number of rows: ");
printf("Enter number of rows: ");
scanf("%d", &rows);
printf("Enter number of columns: ");
scanf("%d", &columns);
for(x = 1; x <= n; x++)
{
for (s = x; s < n; s++)
printf(" ");
for(y = 1; y <= (2 * n - 1); y++)
{
if(x == n || y == 1 || y == 2 * x - 1)
printf("*");
else
printf(" ");
}
printf("\n");
}
for(i=1; i<=rows; i++)
{
for(j=1; j<=columns; j++)
{
if(i==1 || i==rows || j==1 || j==columns)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
return 0;
}