Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Display the pattern like diamond by using c# for loop
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { int i, j, r; Console.Write("\n\n"); Console.Write("Display the pattern like diamond:\n"); Console.Write("-----------------------------------"); Console.Write("\n\n"); r = 3; for (i = 1; i <= r; i++) { for (j = 1; j <= r - i; j++) Console.Write(" "); for (j = 1; j <= 2 * i - 1; j++) Console.Write(i); Console.Write("\n"); } for (i = r - 1; i >= 1; i--) { for (j = 1; j <= r - i; j++) Console.Write(" "); for (j = 1; j <= 2 * i - 1; j++) Console.Write(i); Console.Write("\n"); } } } }
run
|
edit
|
history
|
help
0
fsdf
dict
true or false
2 3
p1
lj
a5
hacktonxx
free robux
.,.