google-research / google-research/language

C code

Open
#128 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.