Csharp program to print Rhombus of numbers:
int nu = 5;
for (int i = 1; i <= nu; i++)
{
for (int j = 1; j < i; j++)
{
Console.Write(j);
}
for (int j = i - 2; j > 0; j--)
{
Console.Write(j);
}
Console.WriteLine();
}
for (int i = 1; i <= nu; i++)
{
for (int j = 1; j < i; j++)
{
Console.Write(j);
}
for (int j = i - 2; j > 0; j--)
{
Console.Write(j);
}
Console.WriteLine();
}
Output :
1
121
12321
1234321
No comments:
Post a Comment