Console.WriteLine("Program for displaying pattern of *."); Console.Write("Enter the maximum number of *: "); int n = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("\nHere is the Diamond of Stars\n"); for (int i = 0; i <= (n - 1); i = i + 2) { for (int j = 0; j <= i; j++) Console.Write("*"); Console.WriteLine(); } for (int i = n - 1; i >= 1; i = i - 2) { for (int j = 0; j < (i - 1); j++) Console.Write("*"); Console.WriteLine(); }
foreach
for
Int32
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)