Advertisement
AvengersAssemble

ShapesWithLoops

Sep 14th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 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 ShapesWithLoops
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int length;
  14.             length = int.Parse(Console.ReadLine());
  15.             for (int i = 0; i < length; i++)
  16.                 Console.WriteLine("*****");
  17.             Console.WriteLine("\n");
  18.             for (int i = 0; i < length; i++)
  19.             {
  20.                 if (i == 0 || i == length - 1)
  21.                     Console.WriteLine("*****");
  22.                 else
  23.                     Console.WriteLine("*   *");
  24.             }
  25.             Console.WriteLine("\n");
  26.             for (int i = 0; i < length; i++)
  27.             {
  28.                 for(int a = length - (i+1); a>=0; a--)
  29.                     Console.Write(" ");
  30.                 for (int b = 0; b <= i; b++)
  31.                     Console.Write("*");
  32.                 Console.WriteLine();
  33.             }
  34.             Console.WriteLine("\n");
  35.             for (int i = 0; i < length; i++)
  36.             {
  37.                 for (int a = length - (i + 1); a >= 0; a--)
  38.                     Console.Write(" ");
  39.                 if (i == length - 1 || i == 0)
  40.                 {
  41.                     for (int b = 0; b <= i; b++)
  42.                         Console.Write("*");
  43.                 }
  44.                 else
  45.                 {
  46.                     Console.Write("*");
  47.                     for (int c = 1; c < i; c++)
  48.                         Console.Write(" ");
  49.                     Console.Write("*");
  50.                 }
  51.                 Console.WriteLine();
  52.             }
  53.             Console.ReadLine();
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement