Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // C#
- int n = 5;
- string output = "";
- for (int i = 1; i <= n*2-1; i++)
- {
- output += "1";
- int last = i <= n ? i : n*2-i;
- for (int j = 2; j <= last; j++)
- {
- output += "-" + j;
- }
- output += "\r\n";
- }
- // print output
Add Comment
Please, Sign In to add comment