Advertisement
Qrist

Rhombus Made of Stars

Apr 18th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     public static void Main(string[] args)
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.         int temp = 1;
  9.         for (int i = 0; i < n; i++)
  10.         {
  11.             Console.Write(new string(' ',n-temp));
  12.             for (int j = 0; j < temp; j++)
  13.             {
  14.                 Console.Write("* ");
  15.             }
  16.             Console.WriteLine();
  17.             temp++;
  18.         }        
  19.         temp = n-1;
  20.         for (int i = 0; i < n - 1; i++)
  21.         {
  22.             Console.Write(new string(' ', n - temp));
  23.             for (int j = 0; j < temp; j++)
  24.             {
  25.                 Console.Write("* ");
  26.             }
  27.             Console.WriteLine();
  28.             temp--;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement