Pattern printing program number 5 most impotent
*
*A*
*A*A*
*A*A*A*
*A*A*A*A*
Implementation of Pattern printing program number 5 most impotent :
using System;
namespace patternProblem
{
class Pattern114
{
public static void Main()
{
Console.WriteLine("Enter loop iteration times: ");
int n = Convert.ToInt32(Console.ReadLine());
int j;
int i;
int k;
Console.WriteLine("-----Output-----");
Console.WriteLine();
for (i = 1; i <= n; i++)
{
for (j = 1; j <= ((n + 1) - i); j++)
{
Console.Write((char)(64 + j));
}
for (k = 1; k < i; k++)
{
Console.Write(" ");
}
for (j = 1; j <= ((n + 1) - i); j++)
{
Console.Write((char)(64 + j));
}
Console.WriteLine();
}
for (i = 2; i <= n; i++)
{
for (j = 1; j <= i; j++)
{
Console.Write((char)(64 + j));
}
for (k = 1; k <= n - i; k++)
{
Console.Write(" ");
}
for (j = 1; j <= i; j++)
{
Console.Write((char)(64 + j));
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
Comments
Post a Comment