Hello
I have this method:
for upperBound = 7; result should be: "0 1 4 9 16 25 36 49" but in my case is "0 1 4 9 16 25 36 49 " it contains a space at the end of the string. I don't know how to remove only that space and still add a space between the letters. I would appreciate any ideas. Thanks!
I have this method:
public static string Puzzle(int upperBound) {
string result = " ";
for (int i = upperBound; i >=1; i--) {
result = i*i+ " " + result;
}
return result;
}
for upperBound = 7; result should be: "0 1 4 9 16 25 36 49" but in my case is "0 1 4 9 16 25 36 49 " it contains a space at the end of the string. I don't know how to remove only that space and still add a space between the letters. I would appreciate any ideas. Thanks!