using System;
class Program {
public static void Main (string[] args)
{
Console.WriteLine("Menu: n 1. Square n 2. Rectangle n 3. Triangle n 4. Rhombus n 5. Christmas Tree");
int a = int.Parse(Console.ReadLine());
switch(a)
{
case 1:
Console.Write("a = ");
int l = int.Parse(Console.ReadLine());
for(int i = 1; i <= l;i++)
{
for(int j = 1; j <= l; j++)
{
Console.Write("* ");
}
Console.WriteLine("");
}
break;
case 2:
Console.WriteLine("a = ");
int x = int.Parse(Console.ReadLine());
Console.WriteLine("b = ");
int y = int.Parse(Console.ReadLine());
for(int i = 0; i<=3;i++)
{
for(int j = 0; j<=5;j++)
{
Console.Write("* ");
}
Console.WriteLine("");
}
break;
case 3:
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5-i; j++)
{
Console.Write(" ");
}
for (int k = 1; k <= i+i-1; k++)
{
Console.Write("*");
}
Console.WriteLine("");
}
break;
case 4:
for (int i = -1; i >= -4; i--)
{
for (int j = -1; j >= -4-i; j--)
{
Console.Write(" ");
}
for (int k = 4; k >= 1; k-=1)
{
Console.Write("* ");
}
Console.WriteLine("");
}
break;
case 5:
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 7-i; j++)
{
Console.Write(" ");
}
for (int k = 1; k <= i+i-1; k++)
{
Console.Write("*");
}
Console.WriteLine("");
}
for (int i = 3; i <= 7; i++)
{
for (int j = 1; j <= 8-i; j++)
{
Console.Write(" ");
}
for (int k = 3; k <= i+i-1; k++)
{
Console.Write("*");
}
Console.WriteLine("");
}
for (int i = 5; i <= 9; i++)
{
for (int j = 1; j <= 9-i; j++)
{
Console.Write(" ");
}
for (int k = 5; k <= i+i-1; k++)
{
Console.Write("*");
}
Console.WriteLine("");
}
for(int i = 1; i <= 4; i++)
{
for(int j = 3; j <= 6; j++)
{
Console.Write(" ");
}
for(int k = 0; k <= 3; k++)
{
Console.Write("*");
}
Console.WriteLine("");
}
break;
}
}
}
Replies to Untitled
Title |
Name |
Language |
UNIX |
When |
Re: Untitled |
Jittery Elephant |
csharp |
1642597731 |
2 Years ago. |
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}