class Test
{
public static void Main()
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <=5 - i; j++)
{
Console.Write(" ");
}
for (int k = 1; k <= i; k++)
{
Console.Write(" *");
}
Console.WriteLine("");
}
}
}
class Class1
{
static void Main(string[] args)
{
Console.WriteLine("Enter the number of rown you wanna print into the pyramid");
int x=Convert.ToInt32(Console.ReadLine());
for(int i=1;i<=x;i++)
{
for(int j=x;j>=1;j--)
{
if(j<=i)
{
Console.Write(" *");
}
else
Console.Write(" ");
}
Console.WriteLine();
}
Console.ReadLine();
}
}
odd and even number in triangle shape ..... please give me code for this output
2
3 5
2 4 6
3 5 7 9
class Program
{
static void Main(string[] args)
{
Console.Write("Enter the number of rown you wanna print into the pyramid:");
int x = Convert.ToInt32(Console.ReadLine());
int temp = 0;
int temp1 = 0;
for (int i = 2; i <= x; i++)
{
temp = 0;
temp1 = 0;
for (int j = 2; j <= i; j++)
{
//check odd number
if (i % 2 != 0)
{
temp = temp + 1;
Console.Write((j + temp) + " ");
}
else
{
Console.Write((j + temp1) + " ");
temp1++;
}
}
Console.WriteLine();
}
Console.ReadLine();
}
}
nice work: for more code visit:
http://webtutorials55.blogspot.com/