SHARE
TWEET

Rhombus of Stars

a guest Jun 27th, 2017 169 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Rhombus_of_Star
  8. {
  9.     class Program
  10.     {
  11.         private static string GenerateFrom(string input, int times)
  12.         {
  13.             StringBuilder builder = new StringBuilder();
  14.             for (int i = 0; i < times; i++)
  15.  
  16.             {
  17.                 builder.Append(input);
  18.             }
  19.             return builder.ToString();
  20.         }
  21.         static void Main(string[] args)
  22.         {
  23.  
  24.             int n = int.Parse(Console.ReadLine());
  25.  
  26.             for (int row = 1; row <= n; row++)
  27.             {
  28.                 Console.Write(GenerateFrom(" ", n - row));
  29.                 Console.WriteLine(GenerateFrom(" *", row));                              
  30.             }
  31.  
  32.             for (int i = n - 1; i > 0; i--)
  33.             {
  34.                 Console.Write(GenerateFrom(" ", n-i));
  35.                 Console.WriteLine(GenerateFrom(" *", i));
  36.             }
  37.  
  38.         }
  39.     }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top