Monday, May 02, 2005

Print the number

using System;

namespace Printapplication
{
class Class1
{

static void Main(string[] args)
{
int n = Convert.ToInt32(Console.ReadLine());
for(int i=1;i<=n;i++) { for(int k=10-i;k>=1;k--)
{
Console.Write(" ");
}
for(int j=i;j>=1;j--)
{
Console.Write(j+" ");
}
Console.WriteLine(" ");
}

for(int s=n-1;s>=1;s--)
{
for(int t=10-s;t>=1;t--)
{
Console.Write(" ");
}
for(int u=s;u>=1;u--)
{
Console.Write(u+" ");
}
Console.WriteLine(" ");
}


Console.ReadLine();
}
}
}


output

5

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
....
..

No comments: