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