Hello,
I'm trying to display a string a number of times. I build a method with 2 parameters: string s and int i; and I want to return s;
So for example if s = "aaa" the result should be "aaa aaa aaa" -----> i-times.
The method looks like this:
but the number of times strins s is displayed is incorrect. I would appreciate a little help. Thank you!
I'm trying to display a string a number of times. I build a method with 2 parameters: string s and int i; and I want to return s;
So for example if s = "aaa" the result should be "aaa aaa aaa" -----> i-times.
The method looks like this:
using System;
public class Program {
public static string Puzzle(int i, string s) {
for (int j = 0; j<i-1; j++) {
s += " " + s;
}
return s;
}
}
but the number of times strins s is displayed is incorrect. I would appreciate a little help. Thank you!