Next
0 / 33
Module DEMO-32-60DEMO-C-32

Solid Square of Stars

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program that reads an integer N and prints a solid square made of asterisks (*) with dimensions N x N.

Example

For N = 3, the output should be:


Requirements

  • Use nested loops to generate the pattern.
  • Each row should contain exactly N asterisks.
  • There should be exactly N rows.

Constraints

You must use nested loops. Do not use string multiplication or built-in pattern functions.

Input Format

A single integer N where 1 <= N <= 20.

Output Format

Print N lines, each containing N asterisks (*). Each line should end with a newline character.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
3
***
***
***
Input: 3
Sample #2
Public sample
5
*****
*****
*****
*****
*****
Input: 5
Sample #3
Public sample
10
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
Input: 10

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings