Display Staircase Pattern

Here given code implementation process.

// C Program 
// Display Staircase Pattern
#include <stdio.h>

// We will use this symbol (▒,▅,▃,▓)
void display_symbols(int size)
{
	for (int i = 0; i < size; ++i)
	{
		printf("▓");
	}
}
//Displaying of Staircase in given size
void staircase_pattern(int size)
{
	if (size <= 0)
	{
		// When get a invalid size
		return;
	}
	// Display size of Staircase
	printf("\n Size : %d\n ", size);
	for (int i = 0; i <= size; ++i)
	{
		display_symbols(i + i);
		//include new line
		printf("\n ");
	}
}
int main()
{
	//Test Cases
	staircase_pattern(8);
	staircase_pattern(12);
	staircase_pattern(3);
	return 0;
}

Output

 Size : 8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
/*
    Java program 
    Display Staircase Pattern

*/
class StaircasePattern
{
	// We will use this symbol (▒,▅,▃,▓)
	public void display_symbols(int size)
	{
		for (int i = 0; i < size; ++i)
		{
			System.out.print("▓");
		}
	}
	//Displaying of Staircase in given size
	public void staircase_pattern(int size)
	{
		if (size <= 0)
		{
			// When get a invalid size
			return;
		}
		// Display size of Staircase
		System.out.print("\n Size : " + size + "\n ");
		for (int i = 0; i <= size; ++i)
		{
			display_symbols(i + i);
			//include new line
			System.out.print("\n ");
		}
	}
	public static void main(String[] args)
	{
		StaircasePattern pattern = new StaircasePattern();
		//Test Cases
		pattern.staircase_pattern(8);
		pattern.staircase_pattern(12);
		pattern.staircase_pattern(3);
	}
}

Output

 Size : 8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
// Include header file
#include <iostream>
using namespace std;

/*
    C++ program 
    Display Staircase Pattern
*/

class StaircasePattern
{
	public:
		//  We will use this symbol (▒,▅,▃,▓)
		void display_symbols(int size)
		{
			for (int i = 0; i < size; ++i)
			{
				cout << "▓";
			}
		}
	// Displaying of Staircase in given size
	void staircase_pattern(int size)
	{
		//  When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//  Display size of Staircase
		cout << "\n Size : " << size << "\n ";
		for (int i = 0; i <= size; ++i)
		{
			this->display_symbols(i + i);
			// include new line
			cout << "\n ";
		}
	}
};
int main()
{
	StaircasePattern pattern = StaircasePattern();
	// Test Cases
	pattern.staircase_pattern(8);
	pattern.staircase_pattern(12);
	pattern.staircase_pattern(3);
	return 0;
}

Output

 Size : 8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
// Include namespace system
using System;

/*
    C# program 
    Display Staircase Pattern

*/

public class StaircasePattern
{
	//  We will use this symbol (▒,▅,▃,▓)
	public void display_symbols(int size)
	{
		for (int i = 0; i < size; ++i)
		{
			Console.Write("▓");
		}
	}
	// Displaying of Staircase in given size
	public void staircase_pattern(int size)
	{
		//  When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//  Display size of Staircase
		Console.Write("\n Size : " + size + "\n ");
		for (int i = 0; i <= size; ++i)
		{
			display_symbols(i + i);
			// include new line
			Console.Write("\n ");
		}
	}
	public static void Main(String[] args)
	{
		StaircasePattern pattern = new StaircasePattern();
		// Test Cases
		pattern.staircase_pattern(8);
		pattern.staircase_pattern(12);
		pattern.staircase_pattern(3);
	}
}

Output

 Size : 8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
<?php
/*
    Php program 
    Display Staircase Pattern

*/
class StaircasePattern
{
	//  We will use this symbol (▒,▅,▃,▓)
	public	function display_symbols($size)
	{
		for ($i = 0; $i < $size; ++$i)
		{
			echo "▓";
		}
	}
	// Displaying of Staircase in given size
	public	function staircase_pattern($size)
	{
		//  When get a invalid size
		if ($size <= 0)
		{
			return;
		}
		//  Display size of Staircase
		echo "\n Size : ". $size ."\n ";
		for ($i = 0; $i <= $size; ++$i)
		{
			$this->display_symbols($i + $i);
			// include new line
			echo "\n ";
		}
	}
}

function main()
{
	$pattern = new StaircasePattern();
	// Test Cases
	$pattern->staircase_pattern(8);
	$pattern->staircase_pattern(12);
	$pattern->staircase_pattern(3);
}
main();

Output

 Size : 8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
/*
    Node Js program 
    Display Staircase Pattern
*/
class StaircasePattern
{
	//  We will use this symbol (▒,▅,▃,▓)
	display_symbols(size)
	{
		for (var i = 0; i < size; ++i)
		{
			process.stdout.write("▓");
		}
	}
	// Displaying of Staircase in given size
	staircase_pattern(size)
	{
		//  When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//  Display size of Staircase
		process.stdout.write("\n Size : " + size + "\n ");
		for (var i = 0; i <= size; ++i)
		{
			this.display_symbols(i + i);
			// include new line
			process.stdout.write("\n ");
		}
	}
}

function main()
{
	var pattern = new StaircasePattern();
	// Test Cases
	pattern.staircase_pattern(8);
	pattern.staircase_pattern(12);
	pattern.staircase_pattern(3);
}
main();

Output

 Size : 8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
#  Python 3 program 
#  Display Staircase Pattern

class StaircasePattern :
	# We will use this symbol (▒,▅,▃,▓)
	def display_symbols(self, size) :
		i = 0
		while (i < size) :
			print("▓", end = "")
			i += 1
		
	
	#  Displaying of Staircase in given size
	def staircase_pattern(self, size) :
		# When get a invalid size
		if (size <= 0) :
			return
		
		#   Display size of Staircase
		print("\n Size : ", size ,"\n ", end = "")
		i = 0
		while (i <= size) :
			self.display_symbols(i + i)
			#  include new line
			print("\n ", end = "")
			i += 1
		
	

def main() :
	pattern = StaircasePattern()
	#  Test Cases
	pattern.staircase_pattern(8)
	pattern.staircase_pattern(12)
	pattern.staircase_pattern(3)

if __name__ == "__main__": main()

Output

 Size :  8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size :  12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size :  3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
#  Ruby program 
#  Display Staircase Pattern

class StaircasePattern 
	#   We will use this symbol (▒,▅,▃,▓)
	def display_symbols(size) 
		i = 0
		while (i < size) 
			print("▓")
			i += 1
		end

	end

	#  Displaying of Staircase in given size
	def staircase_pattern(size) 
		#   When get a invalid size
		if (size <= 0) 
			return
		end

		#   Display size of Staircase
		print("\n Size : ", size ,"\n ")
		i = 0
		while (i <= size) 
			self.display_symbols(i + i)
			#  include new line
			print("\n ")
			i += 1
		end

	end

end

def main() 
	pattern = StaircasePattern.new()
	#  Test Cases
	pattern.staircase_pattern(8)
	pattern.staircase_pattern(12)
	pattern.staircase_pattern(3)
end

main()

Output

 Size : 8
 
 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 
 Size : 12
 
 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 
 Size : 3
 
 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 
/*
    Scala program 
    Display Staircase Pattern

*/
class StaircasePattern
{
	//   We will use this symbol (▒,▅,▃,▓)
	def display_symbols(size: Int): Unit = {
		var i: Int = 0;
		while (i < size)
		{
			print("▓");
			i += 1;
		}
	}
	//  Displaying of Staircase in given size
	def staircase_pattern(size: Int): Unit = {
		//   When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//   Display size of Staircase
		print("\n Size : " + size + "\n ");
		var i: Int = 0;
		while (i <= size)
		{
			this.display_symbols(i + i);
			//  include new line
			print("\n ");
			i += 1;
		}
	}
}
object Main
{
	def main(args: Array[String]): Unit = {
		var pattern: StaircasePattern = new StaircasePattern();
		//  Test Cases
		pattern.staircase_pattern(8);
		pattern.staircase_pattern(12);
		pattern.staircase_pattern(3);
	}
}

Output

 Size : 8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
/*
    Swift 4 program 
    Display Staircase Pattern

*/
class StaircasePattern
{
	//   We will use this symbol (▒,▅,▃,▓)
	func display_symbols(_ size: Int)
	{
		var i: Int = 0;
		while (i < size)
		{
			print("▓", terminator: "");
			i += 1;
		}
	}
	//  Displaying of Staircase in given size
	func staircase_pattern(_ size: Int)
	{
		//   When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//   Display size of Staircase
		print("\n Size : ", size ,"\n ", terminator: "");
		var i: Int = 0;
		while (i <= size)
		{
			self.display_symbols(i + i);
			//  include new line
			print("\n ", terminator: "");
			i += 1;
		}
	}
}
func main()
{
	let pattern: StaircasePattern = StaircasePattern();
	//  Test Cases
	pattern.staircase_pattern(8);
	pattern.staircase_pattern(12);
	pattern.staircase_pattern(3);
}
main();

Output

 Size :  8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size :  12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size :  3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
/*
    Kotlin program 
    Display Staircase Pattern

*/
class StaircasePattern
{
	// We will use this symbol (▒,▅,▃,▓)
	fun display_symbols(size: Int): Unit
	{
		var i: Int = 0;
		while (i < size)
		{
			print("▓");
			i += 1;
		}
	}
	//  Displaying of Staircase in given size
	fun staircase_pattern(size: Int): Unit
	{
		//   When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//   Display size of Staircase
		print("\n Size : " + size + "\n ");
		var i: Int = 0;
		while (i <= size)
		{
			this.display_symbols(i + i);
			//  include new line
			print("\n ");
			i += 1;
		}
	}
}
fun main(args: Array < String > ): Unit
{
	var pattern: StaircasePattern = StaircasePattern();
	//  Test Cases
	pattern.staircase_pattern(8);
	pattern.staircase_pattern(12);
	pattern.staircase_pattern(3);
}

Output

 Size : 8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
// Rust Program 
// Display Staircase Pattern

fn main()
{
	//Test Cases
	staircase_pattern(8);
	staircase_pattern(12);
	staircase_pattern(3);
}
fn staircase_pattern(size: i32)
{
	if size <= 0
	{
		// When get a invalid size
		return;
	}
	// Display size of Staircase
	print!("\n Size : {}\n ", size);
	let mut i: i32 = 0;
	while i <= size
	{
		display_symbols(i + i);
		//include new line
		print!("\n ");
		i += 1;
	}
}
fn display_symbols(size: i32)
{
	let mut i: i32 = 0;
	while i < size
	{
		print!("▓");
		i += 1;
	}
}

Output

 Size : 8

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 12

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

 Size : 3

 ▓▓
 ▓▓▓▓
 ▓▓▓▓▓▓
// C Program 
// Display Staircase Pattern Set B
#include <stdio.h>

// We will use this symbol (▒,▅,▃,▓)
void display_symbols(int size)
{

    for (int i = 0; i < size; ++i)
    {
        printf("▃");
    }
}

// include space
void space(int size)
{

    for (int i = 0; i < size; ++i)
    {
        printf(" ");
    }
}
//Displaying of Staircase in given size
void staircase_pattern(int size)
{
    if (size <= 0)
    {
        // When get a invalid size
        return;
    }
    // Display size of Staircase
    printf("\n Size : %d\n ", size);

    for (int i = 1; i <=size; ++i)
    {
        space((size-i)*2);
        display_symbols(i+i);
        //include new line
        printf("\n ");
    }
}
int main()
{
    //Test Cases
    staircase_pattern(8);
    staircase_pattern(12);
    staircase_pattern(3);
    return 0;
}

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
/*
    Java program 
    Display Staircase Pattern Set B
*/
class StaircasePattern
{
// We will use this symbol (▒,▅,▃,▓)
public void display_symbols(int size)
{
    for (int i = 0; i < size; ++i)
    {
        System.out.print("▃");
    }
}
// include space
public void space(int size)
{
    for (int i = 0; i < size; ++i)
    {
        System.out.print(" ");
    }
}
//Displaying of Staircase in given size
public void staircase_pattern(int size)
{
    if (size <= 0)
    {
        // When get a invalid size
        return;
    }
    // Display size of Staircase
    System.out.print("\n Size : " + size + "\n ");
    for (int i = 1; i <= size; ++i)
    {
        space((size - i) * 2);
        display_symbols(i + i);
        //include new line
        System.out.print("\n ");
    }
}
    public static void main(String[] args) 
    {
        StaircasePattern pattern = new StaircasePattern();
        
            //Test Cases
    pattern.staircase_pattern(8);
    pattern.staircase_pattern(12);
    pattern.staircase_pattern(3);
    }
}

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
// Include header file
#include <iostream>
using namespace std;

/*
    C++ program 
    Display Staircase Pattern Set B
*/

class StaircasePattern
{
	public:
		//  We will use this symbol (▒,▅,▃,▓)
		void display_symbols(int size)
		{
			for (int i = 0; i < size; ++i)
			{
				cout << "▃";
			}
		}
	//  include space
	void space(int size)
	{
		for (int i = 0; i < size; ++i)
		{
			cout << " ";
		}
	}
	// Displaying of Staircase in given size
	void staircase_pattern(int size)
	{
		//  When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//  Display size of Staircase
		cout << "\n Size : " << size << "\n ";
		for (int i = 1; i <= size; ++i)
		{
			this->space((size - i) *2);
			this->display_symbols(i + i);
			// include new line
			cout << "\n ";
		}
	}
};
int main()
{
	StaircasePattern pattern = StaircasePattern();
	// Test Cases
	pattern.staircase_pattern(8);
	pattern.staircase_pattern(12);
	pattern.staircase_pattern(3);
	return 0;
}

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
// Include namespace system
using System;
/*
    C# program 
    Display Staircase Pattern Set B
*/
public class StaircasePattern
{
	//  We will use this symbol (▒,▅,▃,▓)
	public void display_symbols(int size)
	{
		for (int i = 0; i < size; ++i)
		{
			Console.Write("▃");
		}
	}
	//  include space
	public void space(int size)
	{
		for (int i = 0; i < size; ++i)
		{
			Console.Write(" ");
		}
	}
	// Displaying of Staircase in given size
	public void staircase_pattern(int size)
	{
		//  When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//  Display size of Staircase
		Console.Write("\n Size : " + size + "\n ");
		for (int i = 1; i <= size; ++i)
		{
			space((size - i) * 2);
			display_symbols(i + i);
			// include new line
			Console.Write("\n ");
		}
	}
	public static void Main(String[] args)
	{
		StaircasePattern pattern = new StaircasePattern();
		// Test Cases
		pattern.staircase_pattern(8);
		pattern.staircase_pattern(12);
		pattern.staircase_pattern(3);
	}
}

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
<?php
/*
    Php program 
    Display Staircase Pattern Set B
*/
class StaircasePattern
{
	//  We will use this symbol (▒,▅,▃,▓)
	public	function display_symbols($size)
	{
		for ($i = 0; $i < $size; ++$i)
		{
			echo "▃";
		}
	}
	//  include space
	public	function space($size)
	{
		for ($i = 0; $i < $size; ++$i)
		{
			echo " ";
		}
	}
	// Displaying of Staircase in given size
	public	function staircase_pattern($size)
	{
		//  When get a invalid size
		if ($size <= 0)
		{
			return;
		}
		//  Display size of Staircase
		echo "\n Size : ". $size ."\n ";
		for ($i = 1; $i <= $size; ++$i)
		{
			$this->space(($size - $i) * 2);
			$this->display_symbols($i + $i);
			// include new line
			echo "\n ";
		}
	}
}

function main()
{
	$pattern = new StaircasePattern();
	// Test Cases
	$pattern->staircase_pattern(8);
	$pattern->staircase_pattern(12);
	$pattern->staircase_pattern(3);
}
main();

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
/*
    Node Js program 
    Display Staircase Pattern Set B
*/
class StaircasePattern
{
	//  We will use this symbol (▒,▅,▃,▓)
	display_symbols(size)
	{
		for (var i = 0; i < size; ++i)
		{
			process.stdout.write("▃");
		}
	}
	//  include space
	space(size)
	{
		for (var i = 0; i < size; ++i)
		{
			process.stdout.write(" ");
		}
	}
	// Displaying of Staircase in given size
	staircase_pattern(size)
	{
		//  When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//  Display size of Staircase
		process.stdout.write("\n Size : " + size + "\n ");
		for (var i = 1; i <= size; ++i)
		{
			this.space((size - i) * 2);
			this.display_symbols(i + i);
			// include new line
			process.stdout.write("\n ");
		}
	}
}

function main()
{
	var pattern = new StaircasePattern();
	// Test Cases
	pattern.staircase_pattern(8);
	pattern.staircase_pattern(12);
	pattern.staircase_pattern(3);
}
main();

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
#  Python 3 program 
#  Display Staircase Pattern Set B

class StaircasePattern :
	#   We will use this symbol (▒,▅,▃,▓)
	def display_symbols(self, size) :
		i = 0
		while (i < size) :
			print("▃", end = "")
			i += 1
		
	
	#   include space
	def space(self, size) :
		i = 0
		while (i < size) :
			print(" ", end = "")
			i += 1
		
	
	#  Displaying of Staircase in given size
	def staircase_pattern(self, size) :
		#   When get a invalid size
		if (size <= 0) :
			return
		
		#   Display size of Staircase
		print("\n Size : ", size ,"\n ", end = "")
		i = 1
		while (i <= size) :
			self.space((size - i) * 2)
			self.display_symbols(i + i)
			#  include new line
			print("\n ", end = "")
			i += 1
		
	

def main() :
	pattern = StaircasePattern()
	#  Test Cases
	pattern.staircase_pattern(8)
	pattern.staircase_pattern(12)
	pattern.staircase_pattern(3)

if __name__ == "__main__": main()

Output

 Size :  8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size :  12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size :  3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
#  Ruby program 
#  Display Staircase Pattern Set B

class StaircasePattern 
	#   We will use this symbol (▒,▅,▃,▓)
	def display_symbols(size) 
		i = 0
		while (i < size) 
			print("▃")
			i += 1
		end

	end

	#   include space
	def space(size) 
		i = 0
		while (i < size) 
			print(" ")
			i += 1
		end

	end

	#  Displaying of Staircase in given size
	def staircase_pattern(size) 
		#   When get a invalid size
		if (size <= 0) 
			return
		end

		#   Display size of Staircase
		print("\n Size : ", size ,"\n ")
		i = 1
		while (i <= size) 
			self.space((size - i) * 2)
			self.display_symbols(i + i)
			#  include new line
			print("\n ")
			i += 1
		end

	end

end

def main() 
	pattern = StaircasePattern.new()
	#  Test Cases
	pattern.staircase_pattern(8)
	pattern.staircase_pattern(12)
	pattern.staircase_pattern(3)
end

main()

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 
 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 
 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
 
/*
    Scala program 
    Display Staircase Pattern Set B
*/
class StaircasePattern
{
	// We will use this symbol (▒,▅,▃,▓)
	def display_symbols(size: Int): Unit = {
		var i: Int = 0;
		while (i < size)
		{
			print("▃");
			i += 1;
		}
	}
	// include space
	def space(size: Int): Unit = {
		var i: Int = 0;
		while (i < size)
		{
			print(" ");
			i += 1;
		}
	}
	// Displaying of Staircase in given size
	def staircase_pattern(size: Int): Unit = {
		// When get a invalid size
		if (size <= 0)
		{
			return;
		}
		// Display size of Staircase
		print("\n Size : " + size + "\n ");
		var i: Int = 1;
		while (i <= size)
		{
			this.space((size - i) * 2);
			this.display_symbols(i + i);
			//  include new line
			print("\n ");
			i += 1;
		}
	}
}
object Main
{
	def main(args: Array[String]): Unit = {
		var pattern: StaircasePattern = new StaircasePattern();
		//  Test Cases
		pattern.staircase_pattern(8);
		pattern.staircase_pattern(12);
		pattern.staircase_pattern(3);
	}
}

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
/*
    Swift 4 program 
    Display Staircase Pattern Set B

*/
class StaircasePattern
{
	//   We will use this symbol (▒,▅,▃,▓)
	func display_symbols(_ size: Int)
	{
		var i: Int = 0;
		while (i < size)
		{
			print("▃", terminator: "");
			i += 1;
		}
	}
	//   include space
	func space(_ size: Int)
	{
		var i: Int = 0;
		while (i < size)
		{
			print(" ", terminator: "");
			i += 1;
		}
	}
	//  Displaying of Staircase in given size
	func staircase_pattern(_ size: Int)
	{
		//   When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//   Display size of Staircase
		print("\n Size : ", size ,"\n ", terminator: "");
		var i: Int = 1;
		while (i <= size)
		{
			self.space((size - i) * 2);
			self.display_symbols(i + i);
			//  include new line
			print("\n ", terminator: "");
			i += 1;
		}
	}
}
func main()
{
	let pattern: StaircasePattern = StaircasePattern();
	//  Test Cases
	pattern.staircase_pattern(8);
	pattern.staircase_pattern(12);
	pattern.staircase_pattern(3);
}
main();

Output

 Size :  8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size :  12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size :  3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
/*
    Kotlin program 
    Display Staircase Pattern Set B
*/
class StaircasePattern
{
	//   We will use this symbol (▒,▅,▃,▓)
	fun display_symbols(size: Int): Unit
	{
		var i: Int = 0;
		while (i < size)
		{
			print("▃");
			i += 1;
		}
	}
	//   include space
	fun space(size: Int): Unit
	{
		var i: Int = 0;
		while (i < size)
		{
			print(" ");
			i += 1;
		}
	}
	//  Displaying of Staircase in given size
	fun staircase_pattern(size: Int): Unit
	{
		//   When get a invalid size
		if (size <= 0)
		{
			return;
		}
		//   Display size of Staircase
		print("\n Size : " + size + "\n ");
		var i: Int = 1;
		while (i <= size)
		{
			this.space((size - i) * 2);
			this.display_symbols(i + i);
			//  include new line
			print("\n ");
			i += 1;
		}
	}
}
fun main(args: Array < String > ): Unit
{
	var pattern: StaircasePattern = StaircasePattern();
	//  Test Cases
	pattern.staircase_pattern(8);
	pattern.staircase_pattern(12);
	pattern.staircase_pattern(3);
}

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃
fn main()
{
	//Test Cases
	staircase_pattern(8);
	staircase_pattern(12);
	staircase_pattern(3);
}
fn staircase_pattern(size: i32)
{
	if size <= 0
	{
		// When get a invalid size
		return;
	}
	// Display size of Staircase
	print!("\n Size : {}\n ", size);
	let mut i: i32 = 1;
	while i <= size
	{
		space((size - i) * 2);
		display_symbols(i + i);
		//include new line
		print!("\n ");
		i += 1;
	}
}
fn space(size: i32)
{
	let mut i: i32 = 0;
	while i < size
	{
		print!(" ");
		i += 1;
	}
}
fn display_symbols(size: i32)
{
	let mut i: i32 = 0;
	while i < size
	{
		print!("▃");
		i += 1;
	}
}

Output

 Size : 8
               ▃▃
             ▃▃▃▃
           ▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 12
                       ▃▃
                     ▃▃▃▃
                   ▃▃▃▃▃▃
                 ▃▃▃▃▃▃▃▃
               ▃▃▃▃▃▃▃▃▃▃
             ▃▃▃▃▃▃▃▃▃▃▃▃
           ▃▃▃▃▃▃▃▃▃▃▃▃▃▃
         ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
       ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
     ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
   ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
 ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃

 Size : 3
     ▃▃
   ▃▃▃▃
 ▃▃▃▃▃▃

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2021, kalkicode.com, All rights reserved