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

X Pattern

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program that reads an odd integer N and prints an N x N X pattern of stars.

Constraints

1 <= N <= 21, N is odd

Input Format

An odd integer N (1 <= N <= 21).

Output Format

An X pattern.

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
7
*     *
 *   * 
  * *  
   *   
  * *  
 *   * 
*     *
Input: 7
Sample #3
Public sample
1
*
Input: 1
Sample #4
Public sample
13
*           *
 *         * 
  *       *  
   *     *   
    *   *    
     * *     
      *      
     * *     
    *   *    
   *     *   
  *       *  
 *         * 
*           *
Input: 13

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