google-research / google-research/language
C code
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 362
- PR merge metrics
- No merged PRs in 30d
Description
// 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<
Contributor guide
Assessment
This issue has not been assessed yet.