#include<stdio.h>
#include<math.h>
int main()
{
int n=5; //size
int i,j,k;
for (i=1; i<=n; i++)
{
for (j=n-1;j>=i; j--)
{
printf(" "); // 3ws
}
for (k=i-1;k>=-(i-1); k--)
{
printf("%2d ",n-(i-abs(k))+1);
}
printf("\n");
}
return 0;
}
#include<iostream.h>
#include<math.h>
int main()
{
int n=5; //size
for (int i=1; i<=n; i++)
{
for (int j=n-1;j>=i; j--)
{
cout<<" "; // 3 ws
}
for (int k=i-1;k>=-(i-1); k--)
{
cout<<n-(i-abs(k))+1<<" ";
}
cout<<endl;
}
return 0;
}
class PatternProg
{
public static void main(String srgs[])
{
int n=5; //size
for (int i=1; i<=n; i++)
{
for (int j=n-1;j>=i; j--)
{
System.out.print(" ");// 3ws
}
for (int k=i-1;k>=-(i-1); k--)
{
System.out.printf("%2d ",n-(i-Math.abs(k))+1);
}
System.out.println();
}
}
}
using System;
class PatternProg
{
public static void Main()
{
int n = 5; //size
for (int i = 1; i <= n; i++)
{
for (int j = n - 1; j >= i; j--)
{
Console.Write(" ");
}
for (int k = i - 1; k >= -(i - 1); k--)
{
Console.Write(n-(i - Math.Abs(k))+1);
}
Console.WriteLine();
}
Console.ReadKey(true);
} //end of main
} //end of class
n = 5
for x in range(1, n+1):
for y in range(n, x, -1):
print(" ", end="")
for z in range(x - 1, -x, -1):
print(n-(x - abs(z))+1, end="")
print()