@nakov/

nested-for-loops-draw-square-csharp

C#

Draw a square using nested for-loops in C#

fork
loading
Files
  • main.cs
  • main.exe

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.8303233435386337","path":"main.cs","file":{"path":"main.cs","content":{"asEncoding":{"base64":"dXNpbmcgU3lzdGVtOwoKY2xhc3MgRHJhd1NxdWFyZU5lc3RlZExvb3BzIHsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkgeyAgICAgICAgCiAgICAgICAgaW50IG4gPSBpbnQuUGFyc2UoQ29uc29sZS5SZWFkTGluZSgpKTsKICAgICAgICBmb3IgKGludCByb3cgPSAxOyByb3cgPD0gbjsgcm93KyspCiAgICAgICAgewogICAgICAgICAgICBmb3IgKGludCBjb2wgPSAxOyBjb2wgPD0gbjsgY29sKyspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIj0tIik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoKTsKICAgICAgICB9CiAgICB9Cn0K"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System;

class DrawSquareNestedLoops {
    public static void Main() {        
        int n = int.Parse(Console.ReadLine());
        for (int row = 1; row <= n; row++)
        {
            for (int col = 1; col <= n; col++)
            {
                Console.Write("=-");
            }
            Console.WriteLine();
        }
    }
}