saimun1

Romb of stars

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