Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • F first-contributions
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 322
    • Merge requests 322
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • First Contributions
  • first-contributions
  • Merge requests
  • !23122

create hollow square star pattern

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/uttamoffline/master into master Oct 31, 2019
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: uttamoffline

#include <stdio.h>

int main() { int i, j, N;

/* Input number of rows from user */
printf("Enter number of rows: ");
scanf("%d", &N);

/* Iterate over each row */
for(i=1; i<=N; i++)
{
    /* Iterate over each column */
    for(j=1; j<=N; j++)
    {
        if(i==1 || i==N || j==1 || j==N)
        {
            /* Print star for 1st, Nth row and column */
            printf("*");
        }
        else
        {
            printf(" ");
        }
    }

    /* Move to the next line/row */
    printf("\n");
}

return 0;

}

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/uttamoffline/master