+ 1
Need help with loops
I need a algorithm making that pyramid: 1 12 123 1234 12345 ...........
4 Answers
+ 2
In C#... 
string s = ""; 
for(int i = 1; i < 6; i++) 
{
	s += i.ToString();
	Console.WriteLine(s);
} 
+ 1
Just run through a for-loop and add the counter-variable to the string
String str = "";
for (int i = 1; 1 <= 5; i++) {
   str += i.toString();
   System.out.println(str);
}
(Java-Code)
- 1
this is an example of a loop. this one will count from one to 9.
for (int x = 1; x < 10; x++)
{
  Console.WriteLine("Value of x: {0}", x);
}
- 1
hope it helped






