Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C language #1163

Closed
ghost opened this issue Apr 13, 2022 · 1 comment
Closed

C language #1163

ghost opened this issue Apr 13, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 13, 2022

// C++ program to print square inside
// a square pattern
#include
using namespace std;

// Function to print the pattern square
// inside a square
void printPattern(int n)
{
int i, j;

// To access rows of the square
for (i = 1; i <= n; i++)
{
	// To access columns of the square
	for (j = 1; j <= n; j++)
	{

		// For printing the required square pattern
		if ((i == 1 || i == n || j == 1 || j == n) ||
			(i >= 3 && i <= n - 2 && j >= 3 && j <= n - 2) &&
			(i == 3 || i == n - 2 || j == 3 || j == n - 2))
		{
			// Prints star(*)
			cout<<"*";
		}
		else
		{
			// Prints space(" ")
			cout<<" ";
		}
	}

	cout<<endl;
}

}

// Driver Code
int main()
{
int n = 7;
printPattern(n);
return 0;
}

@12wrigja
Copy link
Collaborator

I'm not sure why this is an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant