public class Pattern12
{
public static void main(String[] args)
{
int size ;
size =6;
for (int i = size; i != 0; i--)
{
for (int j = 0; j<size-i; j++)
{
System.out.print(" ");
}
for (int k = 00; k < (2 * i - 1); k++)
{
System.out.print("*");
}
System.out.println();
}
}
}
Python
i=1
for j in range(11,0,-2):
print(i*' '+j*'*')
i = i+1
C program
#include <stdio.h>
int main()
{
int size = 6;
for (int i = size; i != 0; i--)
{
for (int j = 0; j<size-i; j++)
{
printf(" ");
}
for (int k = 0; k < (2 * i - 1); k++)
{
printf("*");
}
printf("\n");
}
}
C# program
using System;
public class Program
{
public static void Main()
{
int num, i, k, count = 1;
num=7;
for (k = 1; k <= num - 1; k++)
{
for (i = 1; i <= count; i++)
Console.Write(" ");
count++;
for (i = 1; i <= 2 * (num - k) - 1; i++)
Console.Write("*");
Console.WriteLine();
}
Console.ReadLine();
}
}
JAVA
Python
C program
C# program
PHP program
need an explanation for this answer? contact us directly to get an explanation for this answer