Hello,
I'm trying to build a function that displays a list of letters in alphabetical order. It has an input parameter : int t. The output should be:
for t=1: --> output: "a b c d e f g h i j k l m n o p q r s t u v w x y z"
for t=2: --> output: "a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x z" -> for the second string letter y is substracted..
.
.
.
In my case:
for t=1: --> output: " a b c d e f g h i j k l m n o p q r s t u v w x y z"
for t=2: -->output: " a b c d e f g h i j k l m n o p q r s t u v w x z a b c d e f g h i j k l m n o p q r s t u v w x z" so for both strings letter y is substracted and it adds a space in front ....I would appreciate any suggestions. Thanks!
I'm trying to build a function that displays a list of letters in alphabetical order. It has an input parameter : int t. The output should be:
for t=1: --> output: "a b c d e f g h i j k l m n o p q r s t u v w x y z"
for t=2: --> output: "a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x z" -> for the second string letter y is substracted..
.
.
.
using System;
public class Program {
public static string LetterList(int t) {
string output = "";
output = (char)('a')+" " + output;
for (int i = 1; i < 26-t; i++)
{
output = output + " " + (char)('a' + i);
}
string output1 = output + " " +(char)('a' +25);
string output2 = "";
for (int j = 0; j<t-0; j++)
{
output2 +=" "+output1 ;
}
return output2;
}
}
In my case:
for t=1: --> output: " a b c d e f g h i j k l m n o p q r s t u v w x y z"
for t=2: -->output: " a b c d e f g h i j k l m n o p q r s t u v w x z a b c d e f g h i j k l m n o p q r s t u v w x z" so for both strings letter y is substracted and it adds a space in front ....I would appreciate any suggestions. Thanks!