C# program to print the star diamond pattern
Program.cs
int i, j; for (i = 1; i <= 7; i++) { for (j = 1; j <= 7 - i; j++) { Console.Write(" "); } for (j = 1; j <= i; j++) { Console.Write("* "); } Console.Write("\n"); } for (i = 6; i >= 1; i--) { for (j = 1; j <= 6 - i; j++) { Console.Write(" "); } for (j = 1; j <= i; j++) { Console.Write(" *"); } Console.Write("\n"); }
Output
kodingwindow@kw:~/csharp$ dotnet run * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * kodingwindow@kw:~/csharp$
Comments and Reactions
What Next?
C# program to print the prime numbers
C# program to find the factorial of a given number
C# program to print the Fibonacci series
Advertisement