// Pyramid Number Program using C#.net
using System;
using System.Linq;
using System.Text;
namespace Triangle
{
class Pyramid
{
static void Main(string[] args)
{
Console.Write("enter the Number :");
int x = int.Parse(Console.ReadLine());
for (int i = 1; i < x; i++)
{
int j ;
for (int l =1; l < x - i; l++)
Console.Write(" ");
for ( j = 1; j <= i; j++)
Console .Write(j.ToString());
for (int k = j - 2; k >= 1; k--)
Console.Write(k.ToString());
Console.WriteLine();
}
Console.ReadLine();
}
}
}
using System;
using System.Linq;
using System.Text;
namespace Triangle
{
class Pyramid
{
static void Main(string[] args)
{
Console.Write("enter the Number :");
int x = int.Parse(Console.ReadLine());
for (int i = 1; i < x; i++)
{
int j ;
for (int l =1; l < x - i; l++)
Console.Write(" ");
for ( j = 1; j <= i; j++)
Console .Write(j.ToString());
for (int k = j - 2; k >= 1; k--)
Console.Write(k.ToString());
Console.WriteLine();
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment