Write the program to implement
*****
***
*
***
*****
public static void Star1(int n) { int k = n; int temp = n; Console.WriteLine(); while (n > 0) { for (int i = 0; i < k; i++) { Console.Write("*"); } Console.WriteLine(); n = n - 1; if (n > temp / 2) { k = k - 2; } else { k = k + 2; } } }
This program will work for odd values of n
No Comments
Filed under:
C#