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