SimeonSheytanov

Rhombus

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