Advertisement
EmoRz

RhombusStars

Jul 23rd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2.  
  3.  class Program
  4.  {
  5.      static void Main(string[] args)
  6.      {
  7.         int n = int.Parse(Console.ReadLine());
  8.  
  9.         for (int row = 1; row <= n; row++)
  10.         {
  11.             for (int col = 1; col <= n - row; col++)
  12.             {
  13.                 Console.Write(" ");
  14.             }
  15.             Console.Write("*");
  16.             for (int col = 1; col <  row; col++)
  17.             {
  18.                 Console.Write(" *");
  19.             }
  20.             Console.WriteLine();
  21.         }
  22.         for (int row = n - 2; row >= 0; row--)
  23.         {
  24.             for (int col = 1; col < n - row; col++)
  25.             {
  26.                 Console.Write(" ");
  27.             }
  28.             Console.Write("*");
  29.             for (int col = 1; col <= row; col++)
  30.             {
  31.                 Console.Write(" *");
  32.             }
  33.             Console.WriteLine();
  34.         }
  35.     }
  36.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement