Csharp program to print a Rhombus:
for (int i = 1; i <= 5; i++)
{
for (int j = i - 1; j > 1; j--)
{
Console.Write(j);
}
for (int j = 1; j < i; j++)
{
Console.Write(j);
}
Console.WriteLine();
}
for (int i = 4; i > 0; i--)
{
for (int j = i - 1; j > 1; j--)
{
Console.Write(j);
}
for (int j = 1; j < i; j++)
{
Console.Write(j);
}
Console.WriteLine();
}
{
for (int j = i - 1; j > 1; j--)
{
Console.Write(j);
}
for (int j = 1; j < i; j++)
{
Console.Write(j);
}
Console.WriteLine();
}
for (int i = 4; i > 0; i--)
{
for (int j = i - 1; j > 1; j--)
{
Console.Write(j);
}
for (int j = 1; j < i; j++)
{
Console.Write(j);
}
Console.WriteLine();
}
No comments:
Post a Comment