Im probably missing something but i cant find a way to solve this simple problem..
im suppost to write a short code asking for a positive integer and then print out a pyramid using FOR statement, f.ex
Height: 0
Height: 4
*
***
*****
*******
Here is the code itself
using System;
namespace starpyramid
{
class program
{
static void Main()
{
Veryfy:
Console.Write("Height: ");
int i = int.Parse(Console.ReadLine());
if(i>0)
{
goto main;
}
else
{
goto Verify;
}
main:
for (int h = 1; h< luku1;h++) // main loop for the lines
{
for (int s = 1; s < luku1; s++) //for spaces before the stars
{
if (s == h)
{
break;
}
Console.Write(" ");
}
Console.Write("*\n");
}
}
}
}
Maybe someone could helpo me solving this