Write a program in C# that asks for a number (x) and a width to show a square of that width.
Use the number to paint the square.
public class DrawSquare
public static void Main(string args)
int x = Convert.ToInt32(Console.ReadLine());
int width = Convert.ToInt32(Console.ReadLine());
for (int row = 0; row < width; row++)
for (int column = 0; column < width; column++)
Practice C# anywhere with the free app for Android devices.
Learn C# at your own pace, the exercises are ordered by difficulty.
Your donations support our work and contribute to the maintenance of the app.
Own and third party cookies to improve our services. If you go on surfing, we will consider you accepting its use.