Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Exercise1
- {
- class Rhombus
- {
- int height;
- public Rhombus(int _height)
- {
- this.height = _height;
- DrawTop();
- DrawBottom();
- }
- void DrawTop()
- {
- for (int row = 0; row < height; row++)
- {
- if (row!=height)
- {
- for (int i = 0; i < height-row; i++)
- {
- Console.Write(" ");
- }
- }
- for (int column = 0; column < row+1; column++)
- {
- Console.Write("* ");
- }
- Console.WriteLine();
- }
- }
- void DrawBottom()
- {
- for (int row = height-1; row >0; row--)
- {
- if (row != height)
- {
- for (int i = 0; i < height - row + 1; i++)
- {
- Console.Write(" ");
- }
- }
- for (int column = row; column >0 ; column--)
- {
- Console.Write("* ");
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement