0% found this document useful (0 votes)
6 views1 page

Code For Printing Hurt

Uploaded by

21491a0773
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Code For Printing Hurt

Uploaded by

21491a0773
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<stdio.

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;
}

You might also like