Advertisement
simonradev

RhombusOfStars

Aug 10th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace LiveDemo
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int size = int.Parse(Console.ReadLine());
  14.  
  15.             string emptySpace = " ";
  16.             string asterisk = "*";
  17.            
  18.  
  19.             int firstPartRows = size;
  20.             for (int currentRow = 1; currentRow <= firstPartRows; currentRow++)
  21.             {
  22.                 for (int currentWhiteSpace = 0; currentWhiteSpace < size - currentRow; currentWhiteSpace++)
  23.                 {
  24.                     Console.Write(emptySpace);
  25.                 }
  26.  
  27.                 Console.Write(asterisk);
  28.  
  29.                 for (int currentCombination = 0; currentCombination < currentRow - 1; currentCombination++)
  30.                 {
  31.                     Console.Write(emptySpace + asterisk);
  32.                 }
  33.  
  34.                 Console.WriteLine();
  35.             }
  36.  
  37.             int secondPartRows = size - 1;
  38.             for (int currentRow = secondPartRows; currentRow > 0; currentRow--)
  39.             {
  40.                 for (int currentEmptySpace = 0; currentEmptySpace < size - currentRow; currentEmptySpace++)
  41.                 {
  42.                     Console.Write(emptySpace);
  43.                 }
  44.  
  45.                 Console.Write(asterisk);
  46.  
  47.                 for (int currentCombination = 0; currentCombination < currentRow - 1; currentCombination++)
  48.                 {
  49.                     Console.Write(emptySpace + asterisk);
  50.                 }
  51.  
  52.                 Console.WriteLine();
  53.             }
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement